I finally had a breakthrough last night as I was helping my daughter with her science fair project (always good to step away to get a better perspective - a little sleep helps too). The code below does exactly what I want it to do.
I do have another question I'll post in another thread. It concerns a macro that can "monitor" a range of data entry cells on a worksheet for user input.
Thank you.
Private Sub Workbook_Open()
' Written by Authors
' Last updated 02/24/2011
' Check to see if the opened workbook is the template workbook or a saved workbook.
' If the opened workbook is the template, the SaveAs code below will run.
' If the opened workbook is a previously saved workbook, the code below is skipped.
If ActiveWorkbook.Name = "TemplateFileName.xlsm" Then
' Open a Message Box informing the user that they MUST save the workbook before use.
MsgBox ("This workbook MUST be saved to the I:\ drive before use.")
Dim Show_Box As Boolean
Dim Response As Variant
' Set the Show_Dialog variable to True.
Show_Box = True
' Begin While loop.
While Show_Box = True
' Show the Save File Instructions Input Box.
Response = InputBox("Save File Instructions", _
"Save File Formatting Instructions")
' Check to ensure the user entered a file name.
If Response = "" Then
Else
' Test to make sure an entry was made.
If Response <> "" Then
' Set the path on the I:\ drive to save the file to
MyPath = "I:\MyPath"
' Set the format of the saved file as a macro-enabled workbook
ActiveWorkbook.SaveAs Filename:=MyPath & "\" & Response, FileFormat:=52
Show_Box = False
Else
End If
End If
' End the While loop.
Wend
Else
Exit Sub
End If
End Sub
Bookmarks