Link to home
Create AccountLog in
Avatar of GD_GRAY
GD_GRAYFlag for United States of America

asked on

How can I have a macro open the "open file" dialog box

Can anyone tell me how to get the script below to NOT open a new workbook, but to load the data into the active sheet from where the macro is ran ?

strFileName = Application.GetOpenFilename("Ascii Files,*.asc", , "File to process.")
Workbooks.OpenText Filename:=strFileName _
, Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
, Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
Avatar of Steve
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of GD_GRAY


Thank you so much. I have been online all day for this. I did have to comment out line 10 but it works like I had wanted. Thank you ! ! !
And just for info: once you have the table in place, you can right click it and select 'Refresh' and it will update based upon the file, reflecting any changes made to the file without having to run the VBA again.