File Names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have one last issue to finish this project. I have a program that uses multipe excel workbooks, and macros that open and access these workbooks as needed. Where my difficulty comes in is in the way they are named in the macro

Example

Workbooks.Open Filename:=
"C:\Documents and Settings\The Competitive Edge\My Documents\Inventory_Program\Inventory.xls

This works only if the person installs the program in that exact location - if not then the program can't find the file. I need to find a way, if possible, to make it so that I can reference it just from the single directory, so in this example it would be in "Inventory Program\Inventory.xls". All the workbooks that I use will be in this one directory, but all the rest depends on where it is installed on a specific computer

I hope this makes since, any help would be greatly appreciated

James
 
Is the workbook with the code in the same folder?

If yes, then you could use this fact:

workbooks.open filename:=thisworkbook.path & "\" & "inventory.xls"
 
Back
Top