![]() |
how to dynamically import a text file
I don't want to hard code the path and file name. I want to make it dynamic.
This is what I have so far but it fails. Any ideas? Thanks a lot, Darren Sub import_cmsies_in_trans() Dim vInv_file As Variant Dim vInv_file_A As Variant vInv_file = Application.GetOpenFilename(Filefilter:= _ "Text Files(*.txt),*.txt", Title:="Open the CMSIES in transit file") 'I can see here that I have the path and name via the msgbox vInv_file_A = "TEXT;" & vInv_file MsgBox (vInv_file_A) With ActiveSheet.QueryTables.Add(Connection:= _ "vinv_file_A", Destination:=Range("A1")) |
how to dynamically import a text file
Try removing the quotes from around vinv_file_A in your QueryTables.Add
line In article , Darren wrote: I don't want to hard code the path and file name. I want to make it dynamic. This is what I have so far but it fails. Any ideas? Thanks a lot, Darren Sub import_cmsies_in_trans() Dim vInv_file As Variant Dim vInv_file_A As Variant vInv_file = Application.GetOpenFilename(Filefilter:= _ "Text Files(*.txt),*.txt", Title:="Open the CMSIES in transit file") 'I can see here that I have the path and name via the msgbox vInv_file_A = "TEXT;" & vInv_file MsgBox (vInv_file_A) With ActiveSheet.QueryTables.Add(Connection:= _ "vinv_file_A", Destination:=Range("A1")) |
All times are GMT +1. The time now is 03:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com