PDA

View Full Version : Solved: Open a workbook from a path stored in a variable



Adonaioc
03-30-2009, 01:16 PM
Call Shell("""Excel.EXE"" ""C:\Documents and Settings\JDoe\Desktop\Part Number\""" & StringTemp, 1)

Through a million combinations and quotes i cannot seem to bust this one open. When i think i almost have it it wont accept the spaces in the path or file name.

any help would be appriciated

I have a script to list all of the paths to all of the files in a directory in the first column starting in the second row. and then i have vba store the first part as a variable "stringtemp" I need to open the file located at the path "stringtemp" so that i can to a replace function to update a part of all the formulas. and then save and go to the next one. I think i have most of it figured out but I am stumped here.

Kenneth Hobs
03-30-2009, 01:23 PM
Shell("cmd /c " & """" & "C:\Documents and Settings\JDoe\Desktop\Part Number\" & StringTemp & """", 1)

Adonaioc
03-31-2009, 06:34 AM
that works but i could not figure out how to turn off updating links

so I decieded to use

Workbooks.Open StringTemp, UpdateLinks:=0

thank you very much, am glad you showed me that method because my next project is opening non excel files, and i will use it then

thanks again.