Hi Dan,
i am looking for something where i click on the button and the excel sheet opens. i have created buttons on the VB excel but i am looking for the coding about how should i link the excel sheet with the command button? please can you help?


Re: command button coding 80 80
Private Sub Command1_Click()

On Error GoTo ErrHandler
    Dim xlApp As Object
    Dim xlWB As Object

    Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = True

    Set xlWB = xlApp.Workbooks.Open("c:\MySheet.xls")
    Exit Sub

    MsgBox "There is a problem opening that workbook", vbCritical, "Error!"

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.