I need vba code to open a HTML file when i click a button in microsoft excel.
Thanks in advance
I need vba code to open a HTML file when i click a button in microsoft excel.
Thanks in advance
Re: Code To Open Html File
you could try this
Private Sub CommandButton1_Click()
If Range("A1") > 1 Then
Shell "C:\Program Files\Internet Explorer\Iexplore.exe www.google.com"
Else
End If
End Sub
this is very basic example - but you get the picture when you click the button it checks to see if cell a1 is greater than 1 - if so launch google.com or else it does nothing.
Hope this helps.
Regards
CDU311
Re: Code To Open Html File
OR (sorry i thought you were meaning the internet)
Private Sub CommandButton1_Click()
If Range("A1") > 1 Then
Shell "F:\Microsoft Office\OFFICE11\excel.exe book1.xls"
Else
End If
End Sub
if you want to open an excel file. see whats happening? you point it to where the file is stored and it will happily open it.
:cool:
Don’t have an account yet? Register yourself now and be a part of our community!