Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto show properties dialog box on save cba Setting up and Configuration of Excel 4 May 18th 09 08:31 AM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Code for a progress dialog?? lifter10101010 Excel Programming 2 November 10th 03 03:47 PM
Changing Save As Type in Save as dialog box Phill Excel Programming 2 August 22nd 03 12:38 PM
Save As Dialog Bob Phillips[_5_] Excel Programming 0 July 8th 03 11:09 PM


All times are GMT +1. The time now is 10:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"