Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to show a save as dialog does not work
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).S how 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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to show a save as dialog does not work
FN = Application.GetSaveAsFilename() 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. . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to show a save as dialog does not work
Kevin,
Me thinks your OnAction assignments are not working. Make Save and Save As .visible = false Create two new buttons and assign your routine to them. The new buttons should have a different caption, so just add a couple of spaces, like... "Save " and "Save As... ". Make sure you delete the new buttons and make the old buttons visible when you exit. Regards, Jim Cone San Francisco, CA **************** "Kevin" wrote in message om... "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) - snip - |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to show a save as dialog does not work
Hi,
if the onaction is not working then why does he show me the form when i click on it(the normal code). I just changed this code to test if I see the dialog. Preceding this procedure is a form, everytime i click on save or save as this form is shown. Thx for your time. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto show properties dialog box on save | Setting up and Configuration of Excel | |||
how to get disk icon on save button of save as dialog like 2000 | Excel Discussion (Misc queries) | |||
Code for a progress dialog?? | Excel Programming | |||
Changing Save As Type in Save as dialog box | Excel Programming | |||
Save As Dialog | Excel Programming |