Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
default location for files open commands
I have the following code in a a macro:
ChDir "N:\pay\payroll\positive pay" myfile = Application.GetOpenFilename("Text Files,*.txt") Workbooks.OpenText FileName:=myfile, StartRow:=1,_ DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,_ ConsecutiveDelimiter:=True, Tab:=True,_ Semicolon:=False, Comma:=False, Space:=True,_ Other:=False, FieldInfo:=Array(Array(1, 1),_ Array(2, 1), Array(3, 1)) Everytime I execute the macro it does not start the open file command from N:\pay\payroll\positive pay....it starts from what ever folder I last had excel looking in. Did I not code this correctly ? Thanks ! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
default location for files open commands
Each drive has a default directory.
ChDir "N:\pay\payroll\positive pay" changes the default directory for the N drive, but if another drive is the default drive, you will open in the default directory for that drive. To make N the default drive as well ChDrive "N" ChDir "N:\pay\payroll\positive pay" or ChDrive "N:\pay\payroll\positive pay" ' uses first character in the string ChDir "N:\pay\payroll\positive pay" -- Regards, Tom Ogilvy "Eric Dreshfield" wrote in message ... I have the following code in a a macro: ChDir "N:\pay\payroll\positive pay" myfile = Application.GetOpenFilename("Text Files,*.txt") Workbooks.OpenText FileName:=myfile, StartRow:=1,_ DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,_ ConsecutiveDelimiter:=True, Tab:=True,_ Semicolon:=False, Comma:=False, Space:=True,_ Other:=False, FieldInfo:=Array(Array(1, 1),_ Array(2, 1), Array(3, 1)) Everytime I execute the macro it does not start the open file command from N:\pay\payroll\positive pay....it starts from what ever folder I last had excel looking in. Did I not code this correctly ? Thanks ! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
default location for files open commands
Tom,
Thanks....I now need to have a conversation with the person whose macro I cloned that faulty coding from and have them change their own macro so that it will work consistently. I'm so glad I found this newsgroup...it has been a wealth of knowledge ! Thanks ! -----Original Message----- Each drive has a default directory. ChDir "N:\pay\payroll\positive pay" changes the default directory for the N drive, but if another drive is the default drive, you will open in the default directory for that drive. To make N the default drive as well ChDrive "N" ChDir "N:\pay\payroll\positive pay" or ChDrive "N:\pay\payroll\positive pay" ' uses first character in the string ChDir "N:\pay\payroll\positive pay" -- Regards, Tom Ogilvy "Eric Dreshfield" wrote in message ... I have the following code in a a macro: ChDir "N:\pay\payroll\positive pay" myfile = Application.GetOpenFilename("Text Files,*.txt") Workbooks.OpenText FileName:=myfile, StartRow:=1,_ DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,_ ConsecutiveDelimiter:=True, Tab:=True,_ Semicolon:=False, Comma:=False, Space:=True,_ Other:=False, FieldInfo:=Array(Array(1, 1),_ Array(2, 1), Array(3, 1)) Everytime I execute the macro it does not start the open file command from N:\pay\payroll\positive pay....it starts from what ever folder I last had excel looking in. Did I not code this correctly ? Thanks ! . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel will not open in default file location | Excel Discussion (Misc queries) | |||
How to change default Open/Files of Type to "Microsoft Excel Files | Excel Discussion (Misc queries) | |||
how do i change the default location of my picture files in Excel | Excel Discussion (Misc queries) | |||
i couldn't open my excel files,it gives location couldn't find err | Excel Discussion (Misc queries) | |||
How do I change the default location for importing text files? | Excel Discussion (Misc queries) |