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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,367
Office Version
  1. 365
Platform
  1. Windows
Andy

Don't use the dialogs, use Application.GetSaveAsFileName, as I suggested in your other thread.:)
 
Upvote 0

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
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

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
ADVERTISEMENT
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

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
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

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
I shudder at the level of my own idiocy sometimes!!!!!!! Thanks NOW it works fine.

Many thanks,

Andy
 
Upvote 0

Forum statistics

Threads
1,195,595
Messages
6,010,632
Members
441,558
Latest member
lambierules

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
Top