Macro solidworks - Opening htm link

Hello, I'm looking for a code so that when I click on my button it opens my link .htm on the internet. But I can't find it.

Hello

Try something like:

Sub Main()
    On Error GoTo Error_CauseAnError

    Dim swApp As SldWorks.SldWorks
    Set swApp = Application.SldWorks

    Dim prog As String
    prog = "C:\Program Files\Mozilla Firefox\firefox.exe"

    Dim strArgument As String
    strArgument = "https://www.lynkoa.com/"
    
    Dim RetVal
    RetVal = Shell("""" & prog & """ """ & strArgument & """", vbNormalFocus)
    
Exit_CauseAnError:
    Exit Sub
Error_CauseAnError:
    MsgBox ("L'accès au programme " & prog & " est impossible.")
    
End Sub

Replacing the values of prog and strArgument with the values that suit you, prog being the path of the program you want to use to browse the internet and strArgument being the path of the file you want to open in your browser.

Kind regards

5 Likes

Thank you d.roger it's perfect:) 

@ D.Roger

Always on top for macros, you are a precious help.

May the force be with you

3 Likes