![]() |
OPEN A FILE
Hello,
I would like to create a Macro that will open a file, which could be located anywhere the user saves the file. I was able to use: Do fName = Application.GetOpenFilename Loop Until fName < True Which works fine but when I doucle click on a file, it doesn't open the file. So I know I'm missing more coding. I need to open the file in Text TAB Delimited which Treat CONSECUTIVE DELIMETERS as one. I also used a different code Workbooks.OpenText Filename:="M:\ZQCMTEST.XLS", Origin:=xlWindows, _ StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, Comma:=False, _ Space:=False, Other:=False, FieldInfo:=Array(Array (1, 2), Array(2, 1), Array( _ 3, 2), Array(4, 1), Array(5, 1), Array(6, 1), Array (7, 1), Array(8, 1), Array(9, 1), Array(10 _ , 1)) Which opens a specific file, but since the file location might be different, I would like for the user to search for the file and open as tab delimited. Any help would be very appreciated. Thanks, Juan |
OPEN A FILE
JUAN,
GetOpenFilename method will only get the fullpath of your file and assign it to a variable. In the case of your code it is "fName". Use this variable in your workbooks.open command Example; Workbooks.OpenText Filename:= fName , (put the other arguments here) Regards, Jon-jon "JUAN" wrote in message ... Hello, I would like to create a Macro that will open a file, which could be located anywhere the user saves the file. I was able to use: Do fName = Application.GetOpenFilename Loop Until fName < True Which works fine but when I doucle click on a file, it doesn't open the file. So I know I'm missing more coding. I need to open the file in Text TAB Delimited which Treat CONSECUTIVE DELIMETERS as one. I also used a different code Workbooks.OpenText Filename:="M:\ZQCMTEST.XLS", Origin:=xlWindows, _ StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, Comma:=False, _ Space:=False, Other:=False, FieldInfo:=Array(Array (1, 2), Array(2, 1), Array( _ 3, 2), Array(4, 1), Array(5, 1), Array(6, 1), Array (7, 1), Array(8, 1), Array(9, 1), Array(10 _ , 1)) Which opens a specific file, but since the file location might be different, I would like for the user to search for the file and open as tab delimited. Any help would be very appreciated. Thanks, Juan |
All times are GMT +1. The time now is 02:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com