Private Sub Workbook_Open()
Dim filename As String
Dim ws As Worksheet
Dim qt As QueryTable
There are multiple sheets in my workbook.
When the workbook opens to another sheet, the following code does not work.
I would like to also import another csv to a different sheet "IMPACT".
Can I first make the Entity worksheet active, so that it will work no matter how it was closed? Also, can I then make the Impact sheet active and import "d:\impact.csv"?
filename = "d:\Entity.csv"
Set ws = Worksheets("Entity")
Set qt = ws.QueryTables.Add("TEXT;" & filename, Range("A1"))
qt.TextFileConsecutiveDelimiter = False
qt.TextFileTabDelimiter = False
qt.TextFileSemicolonDelimiter = True
qt.TextFileCommaDelimiter = True
qt.TextFileSpaceDelimiter = False