Workbook Open Procedure in Custom Template File

H

Hank

I have an Excel file containing raw data (e.g. "RawData.xls") that must be
automatically formatted according to a customized report template. In this
raw data file I have a custom toolbar button that’s assigned a hyperlink to
my Excel report template (e.g. “ReportTemplate.xltâ€). The Excel template has
a Workbook_Open() procedure that automatically formats the raw data file then
closes itself leaving the newly formatted raw data report open. Everything
get’s formatted perfectly, however, after completing the formatting and
closing the report template file a Microsoft Office dialogue box pops up
asking me if I would like to open the file “ReportTemplate.xltâ€. I don’t
understand why it’s attempting to reopen my template again? Any insight and
suggestions would be appreciated.

Here’s a snippet of the Open Workbook procedure contained in
“ReportTemplate.xlt†:

Private Sub Workbook_Open()
' turn off warning messages
Application.DisplayAlerts = False
' Switch to raw data sheet
Workbooks("RawData.xls").Activate
Range("A1").Select

…. ‘ Format Raw data file code is omitted for simplicity sake …


‘ Close “ReportTemplate.xlt†without saving changes
Workbooks("ReportTemplate.xlt").Close SaveChanges:=False
End Sub


Note: Even if I reduce the Open Workbook procedure to the lines shown above,
I still receive the Microsoft Office dialogue box asking me if I would like
to open the template file again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top