Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Dave, just the job. Rob
"Dave Peterson" wrote in message ... If it's always under the \sales folder under the path that contains the workbook with the macro: Sub OpenText() Workbooks.OpenText Filename:=thisworkbook.path & "\sales\SalesInfo.prn", .... === Ps. ThisWorkbook is one word. ChDir ThisWorkbook.Path or ChDir ThisWorkbook.Path & "\Sales" (+ is usually used for adding numbers. & is used for concatenating text.) Rob wrote: Hi, I'm using the following code to import a file SalesInfo but have run into an issue where the file used to run this code resides in a different directory EG c:\work\salesmodel.xls is where the excel file resides and c:\work\sales\ folder is where the data file is stored. I think I need to change my first row of code to included the folder Sales ChDir This Workbook.Path to ChDir This Workbook.Path+"/Sales" [this doesn't work] Sub OpenText() ChDir ThisWorkbook.Path Workbooks.OpenText Filename:="SalesInfo.prn", Origin:=437, StartRow _ :=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 2), Array(8, 1), Array( _ 17, 3), Array(25, 1), Array(36, 1), Array(46, 1), Array(56, 9), Array(61, 9)) End Sub Thanks, Rob -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Links to mapped drive change to refer to local hard drive | Links and Linking in Excel | |||
Obtain drive letter assignment of CD/DVD drive? | Excel Discussion (Misc queries) | |||
Help to Indentify a drive letter | Excel Programming | |||
Using path instead of drive letter | Excel Programming | |||
Find links with code; change from G drive to C drive | Excel Programming |