Template opens instead of copy

L

Ludo

Hi,

I have a template in a TEMPLATE folder on a network drive.
I could open this with a shortcut, and a copy of the template opened
as expected.
Because some settings could change (worksheet in the template), i made
it possible to save the template with the code below (Private Sub
CommandButton1_Click() )

I did make some changes in the setting and saved the template.
From then on started the problem that the template itself opens
instead of a copy.

I'm running on Win XP Professional Version 2002 SP2 & Office 2003 SP3.

Here's the macro to open the template on the network drive.

Sub OpenHassOpvolgblad()

ChDir "\\bvwsrv01\BVW\AV\Operations\HASS\2.Utility and Log file"
Workbooks.Open FileName:="\\bvwsrv01\BVW\AV\Operations\HASS
\2.Utility and Log file\Templates\HASS.xlt", Editable:=False,
Notify:=False
End Sub

In my template i have following code:

Public Const UtilityTemplatePath = "\\bvwsrv01\BVW\AV\Operations\HASS
\2.Utility and Log file\Templates\HASS.xlt"

Private Sub CommandButton1_Click()
' save settings
Application.DisplayAlerts = False
ThisWorkbook.SaveAs FileName:=UtilityTemplatePath
Unload Me
End Sub


Any clue what could have gone wrong, or is the above commandbutton
code the origine of the problem?
Any help welcome.

Ludo
 
D

Dave Peterson

I'd just create a new workbook based on that template:

Dim NewWkbk As Workbook

set NewWkbk _
= workbooks.Add(template:="\\bvwsrv01\BVW\AV\Operations\HASS" _
& "\2.Utility and Log file\Templates\HASS.xlt")
 
L

Ludo

I'd just create a new workbook based on that template:

     Dim NewWkbk As Workbook

     set NewWkbk _
       = workbooks.Add(template:="\\bvwsrv01\BVW\AV\Operations\HASS" _
             & "\2.Utility and Log file\Templates\HASS.xlt")

Thanks Dave, this works.

Ludo
 

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