Hi,
I want to open a html file that I have created in excel (i.e. so it is now in Excel format and not html). I can use 'open with' and select excel as the application to open it, and this works. However, I want to be able to do this in VBA so it automatically opens the html file in excel (I will be doing this for a lot of html files). I have the following code to get to the point of bringing up the "open with" dailogue box, but I want to automatically select excel. Any ideas?
Sub OpenHow()
' String for the file path:
Dim szFileToOpen As String
szFileToOpen = "P:\sasreport-1.1parta.html"
' String for RunDll:
Dim szOpenWith As String
szOpenWith = "rundll32.exe shell32.dll,OpenAs_RunDLL " & szFileToOpen
' Variable for the shell:
Dim vRun As Variant
vRun = Shell(szOpenWith, vbMaximizedFocus)
End Sub
I want to open a html file that I have created in excel (i.e. so it is now in Excel format and not html). I can use 'open with' and select excel as the application to open it, and this works. However, I want to be able to do this in VBA so it automatically opens the html file in excel (I will be doing this for a lot of html files). I have the following code to get to the point of bringing up the "open with" dailogue box, but I want to automatically select excel. Any ideas?
Sub OpenHow()
' String for the file path:
Dim szFileToOpen As String
szFileToOpen = "P:\sasreport-1.1parta.html"
' String for RunDll:
Dim szOpenWith As String
szOpenWith = "rundll32.exe shell32.dll,OpenAs_RunDLL " & szFileToOpen
' Variable for the shell:
Dim vRun As Variant
vRun = Shell(szOpenWith, vbMaximizedFocus)
End Sub