Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi
xl filename and txt file name are names trimed from value in range a1 as below, so excel will have open excel file & dim txt_filename, filepath as string filepath = "C:\Documents and Settings\Administrator\Desktop\" txt_filename = filepath & range("a1").value & ".xls" unable to open text file ? code is below. cant we use string in a1 cell as text file name, ofcourse with prefix path & suffix ".txt", please correct the code below Workbooks.OpenText Filename:=txt_filename, _ Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=True, _ Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _ Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _ Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15 _ , 1), Array(16, 1)), TrailingMinusNumbers:=True ' why i am not able to activate file with variable name Workbooks(xl_filename).Activate any help on this please |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lookup a range in another file? | Excel Discussion (Misc queries) | |||
Range to VLOOKUP as a Variable (range in another file) | Excel Programming | |||
Reference of Range in another file with VB | Excel Programming | |||
Print range within file | Excel Discussion (Misc queries) | |||
Copying range from another file | Excel Programming |