Save .xlsx file as .xlsb

Vbalearner85

Board Regular
Joined
Jun 9, 2019
Messages
139
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I am using the below code to save the macro file as xlsx but want to change it as binary now..

VBA Code:
ThisWorkbook.SaveAs "D:\Hub\" & Format(Date, "dd-mm-yy") & ".xlsx", xlOpenXMLWorkbook

Trying to replace the .xlsx with the .xlsb is not helping..Please advise
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
You need to change the File Format too, not just the extension.
You can get this easily by using the Macro Recorder to record yourself saving a Binary Excel file, and see what code it gives you.
So something like this:
Rich (BB code):
ThisWorkbook.SaveAs "D:\Hub\" & Format(Date, "dd-mm-yy") & ".xlsb", xlExcel12

Note, if this does not work, you will need to use the Macro Recorder on yours to see what value you need.
I am using Excel 365, and it looks like you are using Excel 2016. So the number after "xlExcel..." may be different for you than it is for me.
 
Upvote 0
Solution
You need to change the File Format too, not just the extension.
You can get this easily by using the Macro Recorder to record yourself saving a Binary Excel file, and see what code it gives you.
So something like this:
Rich (BB code):
ThisWorkbook.SaveAs "D:\Hub\" & Format(Date, "dd-mm-yy") & ".xlsb", xlExcel12

Note, if this does not work, you will need to use the Macro Recorder on yours to see what value you need.
I am using Excel 365, and it looks like you are using Excel 2016. So the number after "xlExcel..." may be different for you than it is for me.
Thanks got it...Yes, it is the same format in 2016 as well.I recorded and checked as per your advice...Regards
 
Upvote 0

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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