View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ian[_4_] Ian[_4_] is offline
external usenet poster
 
Posts: 85
Default Oddity when opening templates from code

I have some code to open 2 templates and copy some data from one to the
other. The problem I have is that one opens (template-x.xlt) whereas the
other creates a new xls based on the template (template-y1.xls).

I've posted the code segments below:

---
Sub CheckVersion(sTPPath, sUpdRoot, sVer)
With Application
.EnableEvents = False
.Workbooks.Open Filename:= _
sTPPath & "\" & sUpdRoot & ".xlt", _
UpdateLinks:=0
---
sTPPath is C:\Documents and Settings\ianc\My Documents\Template Prep
sUpdRoot is II checklist
This one opens the template file.

---
Sub OpenUpdate(sCurPath, sUpdRoot, sUpdFile)
With Application
.EnableEvents = False
sUpdFile = Dir(sCurPath & "\" & sUpdRoot & "*.xlt")
.Workbooks.Open Filename:= _
sCurPath & "\" & sUpdFile, _
UpdateLinks:=0 ' ===== Retrieve filename from sUpdFile =====
---
sCurPath is C:\Documents and Settings\...............\Remote update (long
path cut)
sUpdFile is II checklist 6.0.2 update.xlt
This one opens an xls file.

I've tried hardcoding the path & filename for the second one. I've also
tried removing the code for the first one in case it's something to do with
it being the second one open, but it still does the same.

This is driving me nuts!

Any ideas?

Ian