Prompt by macro

  • Thread starter Thread starter papou
  • Start date Start date
P

papou

Hi Nadeem
You could use either of these methods :
Open a file:
Application.Dialogs(xlDialogOpen).Show
Or
Application.GetOpenFilename
Save file as:
Application.Dialogs(xlDialogSaveAs).Show
Or
Application.GetSaveAsFilename

See VBA help for examples
HTH
Cordially
Pascal
 
Hi Nadeem

Sub tester()
Dim OpenName As Variant, SaveName As Variant
OpenName = Application.GetOpenFilename
If OpenName = False Then Exit Sub
SaveName = Application.GetSaveAsFilename
If SaveName = False Then
MsgBox "Will not save " & OpenName
Else
MsgBox OpenName & " will now be " & SaveName
End If
End Sub

Noe that this code only remembers your selections, it does NOT open or save
the files (so it's 100% harmless to test as is). Your code must handle those
actions.
See Help for GetOpenFilename and GetSaveAsFilename; there are ways to
spesify filetype filter, default names, ...

HTH. best wishes Harald
 
Hi
I am building a macro which involves opening a file and saving the file with
a different name after performing certain actions.

Is it possible macro prompts to enter the file name as to which file to open
and prompt again as to what name file should be saved.

thanks in advance
Nadeem
 
Back
Top