View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Can VBA Code change itself?

Bill,

In your spreadsheet, use code like this

Dim myPath As String

myPath = ThisWorkbook.Path
ChDir myPath

It will change your default folder for searches, etc. to the folder that the ss file is stored in.

HTH,
Bernie
MS Excel MVP


"BillCPA" <Bill @ UAMS wrote in message ...
I have a spreadsheet I want to distribute to various people. When it runs,
it pulls data from an outside spreadsheet into itself and processes it. Each
person that I distribute it to will have the data to be pulled in a folder on
their machine. And the spreadsheet I give them will probably be in the same
folder.

Can I set a variable in the code with an initial null value, then put a
textbox on the menu form, have them enter the folder name, then permanently
change the variable value to what they enter, so that the next time they open
the spreadsheet, the folder name they entered last time is already there.

--
Bill @ UAMS