7 replies
by bablhous Accepted solution
by maevinn Accepted solution
by bablhous Accepted solution
Actually, that's how I started out - it just felt reasonable but it didn't help. I tried your suggestion again (maybe I keyed it in wrong or something the first time) but I still get the following error message: 'Run-time error '9': Subscript out of range.'
I've tried it with and without the quote marks, with and without the forward slash. I'm simply not getting it and I feel it's something obvious that I'm just not seeing.
Thanks for your help so far - any other ideas?
by maevinn Accepted solution
by bablhous Accepted solution
Tried forward slashes, tried backward slashes, tried with C: (both forward and backward), tried it with c:// and c:\\. The closest I came to resolving this was some info I unearthed saying that if both were opened simultaneously, my problem would be moot but the new resource gave no clue as to how I would manage this.
I really have no idea why this won't work. It should. ** teeth gnashing sound **
Thanks for sticking with me on this -- I do appreciate it. After today, I wil not be looking at this until the day after Christmas so if we don't speak before then, have a happy holiday. (And if you see Santa before me, ask him for the answer, will you?)
by maevinn Accepted solution
by alexander.hardman Accepted solution
If you use the full name property of a workbook you can return it's complete path as well as the file's name. My solution to the same problem was to retrieve the full name of a file, programmatically count until I got to a '\' and then extract just the folder path to the files.
I then concatenated that path onto the file name I wanted to open.
strFileName = ThisWorkbook.Name
strFullName = ThisWorkbook.FullName
strFileName = "(COPY)" & ThisWorkbook.Name
strFullName = Left(strFullName, InStrRev(strFullName, "\", , vbTextCompare))
The last line is where I pull just the directory path and leave out the file name.
Workbooks.Open (strPathToSave & "template.xlt")
Hope that helps. I can clarify if you need me to.
This discussion is closed to new replies.
Trending Networks posts
Sort by Trending