ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Template opens instead of copy (https://www.excelbanter.com/excel-programming/443575-template-opens-instead-copy.html)

Ludo

Template opens instead of copy
 
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

Dave Peterson[_2_]

Template opens instead of copy
 
I'd just create a new workbook based on that template:

Dim NewWkbk As Workbook

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



On 08/31/2010 08:23, Ludo wrote:
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


--
Dave Peterson

Ludo

Template opens instead of copy
 
On 31 aug, 16:02, Dave Peterson wrote:
I'd just create a new workbook based on that template:

* * *Dim NewWkbk As Workbook

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

On 08/31/2010 08:23, Ludo wrote:





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


--
Dave Peterson- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -


Thanks Dave, this works.

Ludo


All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com