How to force file to save as .xlsx

austin397

New Member
Joined
Dec 16, 2016
Messages
36
Hello all,

Code:
    File_Name = SK & "-" & Year & Month & Day & "-" & Daily_Drawing_Number & " BOM" & Rev_Letter & ".xlsx"    
    Application.Dialogs(xlDialogSaveAs).Show (File_Name)

I am trying to force this to input the specified file name into the dialogue box for the save as box. However it remains blank when I use the extension ".xlsx" but when it is ".xls" it works fine.

I need this to be saved as ".xlsx" so that it will be macro-free.

Thank you for any help!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Why using dialog when you have constructed file name? You need just to select folder (if you don't have one).
 
Upvote 0
I need to keep the save as dialog because the user might need to save the files in different locations than others. Some might save it to their desktop, others to specific files.
 
Upvote 0
I was able to get an answer elsewhere, thank you anyway!

Here was the solution.
Code:
Application.DisplayAlerts = False
Work_Saved = Application.Dialogs(xlDialogSaveAs).Show(File_Name, 51)
Application.DisplayAlerts = True

The 51 is how excel reads the format.

51 = xlOpenXMLWorkbook (without macro's in 2007-2016, xlsx)
52 = xlOpenXMLWorkbookMacroEnabled (with or without macro's in 2007-2016, xlsm)
50 = xlExcel12 (Excel Binary Workbook in 2007-2016 with or without macro's, xlsb)
56 = xlExcel8 (97-2003 format in Excel 2007-2016, xls
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,252
Members
449,075
Latest member
staticfluids

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