ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting up a workdirectory (https://www.excelbanter.com/excel-programming/281027-setting-up-workdirectory.html)

solo_razor[_19_]

setting up a workdirectory
 
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



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Chip Pearson

setting up a workdirectory
 
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


"solo_razor" wrote in message
...
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



------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com