open several workbooks at the same time
On 7 June, 15:03, "Rick Rothstein"
wrote:
just pluged in my pen stick into my works PC and it wont open the
files - coz the file drive at work is called e.g *F: * at home its
called *G:
so the workbooks dont get found unless I manually change the drive in
the code text
hope this makes sense.
example *Workbooks.Open ("F:\Direct Payments DOT\0.5 yearly payment
planner.xls")
Are you opening the "main" workbook (the one with the code in it) from the
"pen stick" also? If so, you can use ThisWorkbook.Path to get the path to
the workbook... if that is the same directory for all files (in both the pen
stick and your work computer), then you can use that in its entirety in
place of the hard-coded path you showed in your (single) example. Or, if
everything is not in the same ultimate directory, you can "rob" the drive
letter from the front of ThisWorkbook.Path (use the Left function to do
that) and use it instead of hard-coding the letter.
--
Rick (MVP - Excel)
--
Rick (MVP - Excel)
thanks Rick,
Dont quite understand "rob" anyway what I have done is to rename the
pen drive letter to "X" and changed the codes to read / look for "x"
this wont conflict with home or office. But I am still interest in
what you mean by rob, how do i use the left function instead of hard
coding the letter
best wishes
Johnny
|