SaveAs on opening workbook

AusSteelMan

Board Regular
Joined
Sep 4, 2009
Messages
208
Hi everyone,

I would like to have the SaveAs dialogue box appear when the workbook is opened.

I do not need a cell value to become the name or anything like that.

The ability to click Cancel should still exist.

The purpose is to prompt the user to save as a new name before altering the existing data.

I had a quick trawl but couldn't really find what I needed.

Thanks to anyone who can help out
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You could put this in the ThisWorkbook code module.
Code:
Private Sub Workbook_Open()
    Application.Dialogs(xlDialogSaveAs).Show
End Sub
Or when you Save your file As, you could use Options to select Always Create Backup and Excel will do it automatically without code.
 
Upvote 0
Hi guys

Thanks to both of you again.

Blade,
The linked page had code I altered since I did not want it to provide a new name.

mike,
That code didn't appear to work. When I used the line to open the dialogue box in the immediate window, it worked, but did nothing when the book opened.

I ended up with a compromise:
Sub Auto_Open()
Application.Dialogs(xlDialogSaveAs).Show
End Sub

This appears to work OK. Is there a difference between Auto_Open and Workbook_Open?

Thanks again.
Darren
 
Upvote 0
Were you putting the workbook open one at the workbook level in the VBE? Using the auto_open is a very old method, I wasn't aware that it still worked to be honest.
 
Upvote 0
Dan,

No I was a goose and used it in a regular module.

Of course when in This Workbook, mike's works correctly (like I thought it would)

Sorry for wasting your time on something I should have done properly in the first place (but I appreciate it anyway!)

Cheers,
Darren
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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