There's a few different ways of approching this using
VB depending on what you want to do. I like to keep the code seperate from the data so write to minipulate data on the ActiveWorkbook or have the code open and act on a defined workbook. So you can refer to an absolute defined path or use reserved statements for example:
ActiveWorkbook.Path,
ThisWorkbook.Path ThisWorkbook would give you the path from the file the script is running in. Active Workbook whatever path the active workbook exists in. I wouldn't define outside links using
VB as that just replicates the problem your having in the first place. You could have
VB check a file in a specifide location and pull data into your workbook from that file. An update query or process. And you can use a Function to derive a path. I often use a function to obtain the path N folders up from the working file directory. This way I can develop on say a local directory with the same folder structure as the Server location. Then once I deploy the program it is not necessary to set or change any paths in the code.
Quote:
|
Originally Posted by ontheDB
Thanks for the reply. Guess it'll explain why I couldn't find a solution here or on the internet.
So would the VBA psuedo-code would go something like:
Start
Use some function to get current directory.
Manually update each cell with the new current working directory.
End.
Thanks,
|