SaveAs .xls in 2007

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,356
I am using Excel 2007 and want to allow users of a workbook to save the file as any name they choose, but only as an xls, not an xlsm. I can't find code that works for this in Excel 2007.
 
It must be from some other section of your code? (running it as a standalone seem to work fine...only asked once).

What is this bit of code doing?

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi dantheman,

Interesting question and I'm not entirely sure of the answer. I put the code in ThisWorkbook to trap the save event and that always comes up automatically.
 
Upvote 0
If you save the workbook in the beforesave event, then you will trigger the event again. You need to disable events before saving:

Application.enableevents = false
' save code here
Application.enableevents = true

You should also only run your code if saveasui = true
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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