Automatically saving a template

TempoTours

Board Regular
Joined
Aug 23, 2007
Messages
89
Hello, I work in an office where there are about 20 people that use excel templates that are found in one folder and they are *supposed* to save the template into a client folder elsewhere. The problem is that this doesn't always happen and the templates get worked in. What I would like to do is write a code that will automatically run when the template is opened, forcing the user to save as somewhere else, then when the template is saved, the autrun is disabled. Any suggestions?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
If you have a template setup and you create a desktop shortcut, it will automatically open up a copy of the template and not the actual template. I'm now sure how else to get a copy open based off a template. Hope this helps!
 
Upvote 0
Out desktops are already too full...to add another 20+ templates too it would be too much. I've been able to write a code where I place an 'X' in a cell in the template and then the auto open macro calls another macro that checks to see if the 'X' is there. If it isn't, it stops, if the 'X' is there, it asks you to save, then deletes the 'X'. I was hoping there would be a better way, expecially if someone actually does save as the template, then the template would have the 'X' deleted.
 
Upvote 0
Okay, I have it figured out...In the worksheet, I have this auto run option:
Sub workbook_open()
Call NewFile
End Sub
Then, the code for the check to see if it should be saved or not is this:

Sub NewFile()

If ThisWorkbook.FullName = "F:\xdata\CAIS\Production Schedules.xls" Then

' This message box lets the user know that they are to save the file as

MsgBox "Please select the new location to save your file."

'Retrieve file name to use for Save
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

'If user specified file name, perform Save and display msgbox
If fileSaveName <> False Then

ActiveWorkbook.SaveAs Filename:=fileSaveName, FileFormat:=xlNormal

MsgBox "Saved as " & fileSaveName
End If
Else
End
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,352
Members
449,080
Latest member
Armadillos

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