Opening a file

  • Thread starter Thread starter Ed Davis
  • Start date Start date
E

Ed Davis

I am trying to open a file that I have saved. I am having the following
problem.

Sometimes it will open but other times I have to change the path.

The problem I have is that because I distribute the main file to several
people the exact path is different because of the user profile.


Workbooks.Open Filename:= _
"Ugrounds.xls"

Is there a way to stop the debugger from coming up and changing the path?

Thanks in advance.

Ed Davis
 
Davis,

I have an idea that you have to make a database or setting wich a file
contains data about your clients like: [UserName];[Path]
example:

John;C\DATA\2007\
Edgar;E\SERVERDATA\
etc...

Wich saved in a txt file then you have to initialize to read them before
saving file
 
Ed,
If you do not know what the path is, get the user to locate it first. See:
Application.GetOpenFilename

NickHK
 
The path is always the same except for the user profile.

Example :
C:\Documents and settings\store2113\my documents\dailywork\Ugrounds.xls


The "store2113" is the only thing that is different.

Is there a way to have the macro open the file using
"C:\Documents and settings\%user profile%\My
Documents\Dailywwork\ugrounds.xls"?
 
Ed,
?Environ("UserName")

NickHK

Ed Davis said:
The path is always the same except for the user profile.

Example :
C:\Documents and settings\store2113\my documents\dailywork\Ugrounds.xls


The "store2113" is the only thing that is different.

Is there a way to have the macro open the file using
"C:\Documents and settings\%user profile%\My
Documents\Dailywwork\ugrounds.xls"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top