Populate "Save As..." Dialog box

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
Hi there,

I have another question surrounding VB coding being used to initiate Dialog Boxes. I have managed to activate the "Save As..." dialog box however I would find it handy if I could populate the filename box with a pre-determined file name such as "Application (PLEASE ENTER YOUR NAME).xls"

Is this possible. I would normally have the program determining everything here but the user has to be able to define the save location manually.

Many thanks,

Andy
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Andy

Don't use the dialogs, use Application.GetSaveAsFileName, as I suggested in your other thread.:)
 
Upvote 0
Sorry if it sounded like I was ignoring your advice guys, I've just changed to using this method now and it works a bloody treat! Thanks again!
 
Upvote 0
Spoke too soon!

Heres the code I've written...

Sub ExportPrintout()

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Dim Message, VersionName, SaveFile As String

VersionName = Sheets("FFData").Range("VersionName").Value

Config1 = vbOKOnly + vbInformation

Sheets("Printout").Select
Cells.Copy
Range("A1").Select
Workbooks.Open Filename:="\\fs01edx\grpareas\bbtapp\Protection\OSCA\Printout (Template).xls", ReadOnly:=True
Sheets("Printout").Select
Range("A1").Select
ActiveSheet.Paste
Cells.Copy
Cells.PasteSpecial xlPasteValues
Range("A1").Select

SaveFile = Application.GetSaveAsFilename(InitialFileName:="Fact Find (CustomerName).xls", FileFilter:="Excel Files (*.xls),*.xls", Title:="Please Save Your Fact Find")

ActiveWorkbook.Close
Workbooks("" & VersionName & "").Activate
Message = MsgBox("You have successfully saved the Fact Find.", Config1, "" & VersionName & "")

Sheets("FFIntro").Select
Range("A1").Select

End Sub


...and it runs fine but nothing seems to be saving to any file location I choose???
 
Upvote 0
The GetSaveAsFilename Method does not initiate a Save Action. It only GETS the Name to use, and assigns it to a variable. THEN you need to have a Seperate SAVEAS command to save it (using the variable as the filename)...

SaveFile = Application.GetSaveAsFilename(InitialFileName:="Fact Find (CustomerName).xls", FileFilter:="Excel Files (*.xls),*.xls", Title:="Please Save Your Fact Find")
ActiveWorkbook.SaveAs SaveFile
 
Upvote 0
I shudder at the level of my own idiocy sometimes!!!!!!! Thanks NOW it works fine.

Many thanks,

Andy
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,174
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top