Hi all, I have a problem, when I import an HTML file it automatically opens another worksheet (data). I would like to know how to import the data into the same worksheet(sheet1).
This is the code that I found:
I wish that somebody could help me. Thanks in advance.
This is the code that I found:
VBA Code:
Sub import_file()
Dim WS As Variant
Dim WD As Worksheet
Dim myFile As Variant
Set WD = ThisWorkbook.ActiveSheet
myFile = Application.GetOpenFilename("HTML Files (*.html), *html*", , "Choose File", "Open", False)
If myFile = False Then
Exit Sub
Else
Workbooks.Open (myFile)
Set WS = ActiveWorkbook.ActiveSheet
End If
Application.ScreenUpdating = False
WS.Activate
'WS.Copy
ActiveWorkbook.Close
Application.ScreenUpdating = True
MsgBox "Data Updated"
End Sub