Link to home
Start Free TrialLog in
Avatar of Euro5
Euro5Flag for United States of America

asked on

Importing text file not replacing data

Sub Workbook_Open()
    filename = "G:\RTMCOMM\Entity.csv"
    Set ws = Worksheets("Entity")
    Set qt = ws.QueryTables.Add("TEXT;" & filename, ws.Range("A1"))
    qt.TextFileConsecutiveDelimiter = False
    qt.TextFileTabDelimiter = False
    qt.TextFileSemicolonDelimiter = True
    qt.TextFileCommaDelimiter = True
    qt.TextFileSpaceDelimiter = False
    qt.Refresh
End Sub

Open in new window


I am using the above to bring in a text file on open.
However, rather than replacing the existing text, it is moving to the next open column and pasting there.

Should I clear the contents before closing?
Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Steve
Steve
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Euro5

ASKER

That was VERY helpful!! Thanks!