setting up a workdirectory

  • Thread starter Thread starter solo_razor
  • Start date Start date
S

solo_razor

Hello,

i have a problem with a directory. The following is pre programmed
In my sheet cell a119 contains a value c:\windows\desktop

later in the vba code this value has given a variable
dir = activesheet.range("a119").value
dir is now know as c:\windows\desktop

Now i am working on a sheet that must be saved under a name in this dir
directory

chdir = dir
returns argument not optimal, does anybody knows how it schould be.

Regards,
Niek
 
Niek,

First off, you shouldn't use Dir as a variable name because Dir is a
reserved word in VBA. Instead, use sDir or something. Then, use code like

Dim sDir As String
sDir = Range("A119").Value
ChDrive sDir
ChDir sDir


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
Back
Top