LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Question "Save As" dialog box... (-:

Hi blc,

The problem, as noted by Tom, is that the BeforeSave event fires before the
user is even prompted for the save location.

Here's some code you could use that may get you started on a solution:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim vFullPath As Variant
Dim sInitName As String
Dim sNewName As String

Cancel = True

If SaveAsUI Then
'/ show own save as
sInitName = IIf(InStr(1, FullName, ".xls"), _
FullName, FullName & ".xls")
vFullPath = Application.GetSaveAsFilename(sInitName, _
"Microsoft Excel Workbook (*.xls), *.xls")
If vFullPath = False Then
'/ user cancelled
Else
sNewName = CStr(vFullPath)
Application.EnableEvents = False
SaveAs sNewName
Application.EnableEvents = True
End If
Else
sNewName = FullName
Application.EnableEvents = False
Save
Application.EnableEvents = True
End If

If Len(sNewName) Then MsgBox sNewName
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


blc wrote:
Hello all,

Anyone have any idea how I can get a reference to the "Save As"
dialog box that is instantiated when a user clicks the "Save As"
button on the Excel MAIN toolbar???

I would like to be able to determine what the new filepath and
filename will be in the Workbook_BeforeSave event before the Save
occurs...

Thank you very much,

blc


 
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
"Save In" dialog (dialogue) issue Dan Levin Excel Discussion (Misc queries) 0 April 1st 08 06:20 PM
"Save As WebPage" dialog box missing Luis Excel Discussion (Misc queries) 2 August 31st 06 09:54 AM
How do you turn off "Save a copy/Overwrite changes" dialog box Nicko Excel Discussion (Misc queries) 4 December 8th 05 05:22 PM
Getting "Save as PDF File" Dialog at end of printing to PDF using PDFwriter Chuck Reed Excel Programming 4 May 13th 04 12:01 PM
Question "Save As" dialog box... (-: Tom Ogilvy Excel Programming 0 May 4th 04 07:40 PM


All times are GMT +1. The time now is 07:03 AM.

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

About Us

"It's about Microsoft Excel"