Hard-Coded FileName

C

Clayman

Is it possible to edit a hard-coded filename based on
Application.GetOpenFileName?

I am writing an application that will have many users. The network structure
is constantly in flux, so the full name (ie: \\server\path) will likely
change over the usable life of this application. I would like to store the
path to external data in the application code, but make it editable.

I guess, in short, I'm asking if it's possible to write a VBA code that will
edit VBA code.
 
J

Jonathan West

Clayman said:
Is it possible to edit a hard-coded filename based on
Application.GetOpenFileName?

I am writing an application that will have many users. The network
structure
is constantly in flux, so the full name (ie: \\server\path) will likely
change over the usable life of this application. I would like to store the
path to external data in the application code, but make it editable.

I guess, in short, I'm asking if it's possible to write a VBA code that
will
edit VBA code.

Don't put the path into the code itself, put it somewhere else, such as a
registry entry (use GetSetting and SaveSetting to read & write), or a
document property (look up the CustomDocumentProperties collection) and
read it from there when necessary
 
P

Phil

Is it possible to edit a hard-coded filename based on
Application.GetOpenFileName?

Yes it is.
I am writing an application that will have many users. The network
structure
is constantly in flux, so the full name (ie: \\server\path) will likely
change over the usable life of this application. I would like to store the
path to external data in the application code, but make it editable.

If you want it to be editable, the application code is not the best place
for it. If you're writing code for Excel, you could use a hidden worksheet,
or a Name to store this type of information. Alternatively you can use the
registry (see GetSetting/SaveSetting).
I guess, in short, I'm asking if it's possible to write a VBA code that
will
edit VBA code.

Yes you can do that (e.g. using VBE), but it's a bit of a drastic solution
to a simple problem. Basically if you want to be able to change something
don't hard-code it.
 

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

Top