View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Kevin Kevin is offline
external usenet poster
 
Posts: 8
Default VBA code to show a save as dialog does not work

"Patrick Molloy" wrote in message ...
FN = Application.GetSaveAsFilename()

Thx, but the result is the same. It does not work when I use the
change file menu. I shall include the full code:
in thisworkbook i have the following function
Sub Workbook_Open()
Dim mnu As Menu
Set mnu = MenuBars("worksheet").Menus("File")
With mnu.MenuItems("Save")
.OnAction = "MySave1()"
End With
With mnu.MenuItems("Save As...")
.OnAction = "MySave1()"
End With
With mnu.MenuItems("Save as Web Page...")
.OnAction = "MySave2()"
End With
End Sub
Then in the module I have the following code:
Sub MySave1()
FN = Application.GetSaveAsFilename
'UserForm1.Show
End Sub
Which I altered to test whether or not I get the dialog.
Do I overwrite the dialog somehow because I overwrite the menu or
something???
Because this is actually the problem. The funny thing however is that
if i run it normal(with the userform) he shows the userform twice en
then disappears(after twice clicking ok of course, so if i click ok
the first time it reappears)

Read all about GetSaveAsFilename in help as its well
explained

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Hi all,

I created a macro to intercept the save and save as in

excel.
Then I want to force people to fill in the properties,

which works and
then I want to show the save as dialog.
The funny thing is that I see the dialog when I start it

inside the vb
editor, however it never appears on the screen when I

run the code
from the workbook.
I used the following codes:
ThisWorkBook.Application.Dialogs(xlDialogSaveAs). Show
Excel.Application.Dialogs(xlDialogSaveAs).Show
Application.Dialogs(xlDialogSaveAs).Show
All of the three appear inside the vb editor but none of

them inside
my workbook(that is when the user click on the save/save

as button)
That code does work because it intercepts the save/save

as and shows
the userform i created.

Does anyone know why this is happening??

Thank you.
.