Window 7 - Excel 2010 setting? VBA ActiveSheet.SaveAs Filename not posting name to dialog box

portews

Active Member
Joined
Sep 4, 2009
Messages
437
Office Version
  1. 2016
  2. 2003 or older
Platform
  1. Windows
I recently changed over from a Windows XP box running Excel 2010 to a 64 bit Window 7 box running Excel 2010. One of my macros would bring up a save box upon opening, making the user save the template. I would populate the filename with a new name and allow the user to select the directory.

ThisFile = Worksheets("Transmittal").Range("F1").Value
newName = Application.GetSaveAsFilename("S:\Transmittal " & ThisFile & ".xls")
If newName = False Then GoTo do_not_overwrite
ActiveSheet.SaveAs Filename:=newName

On the new box, when the macro is run, the save dialog comes up, the the filename does not populate.

Is this a setting in Excel, a glitch in Windows 7 or a change in programming requirements?

Thanks!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
One of our inhouse Gurus came to my rescue. He found a link that explains this problem (see link for full explaination below). It has to do with the file filter criteria.

  • if the extension of the filemane you provide is the same as the last one in the filter criteria, the name is not cleared
  • if you do not provide an extension on the filename, the name is also not cleared
  • if you supply an extension that is either not in the list of wildcard extensions or not the last one, the name is cleared (in XP the full name would be enclosed in double quotes)

The fix is to set a file filter criteria that will match the file type you want to save as before the save.

Dim sFilter as text
...
sFilter = "Excel Macro Enabled filter,*.xlsm;*.xlsb;*.xls,All Files,*.*"

Weird bug in Excel’s Application.GetSaveAsFileName() function on Vista and 7 | Dutch Gemini's Weblog Pages
 
Upvote 0
Solution

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

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