excelvba

How to open an excel without running the Workbooks.Open macro in it


I have a vba code that calls my procedure whenever openning that excel.

Sub WorkBook_Open()
Call Sheets("Result").main
End Sub

My concern is , that main function will send email out. So in future if I want to edit that excel, how can i open it without triggering the call?

My initial intention was to use command line to run the vba function everyday and send that report automatically


Solution

    1. Open the Excel Application.
    2. Go to File ~ Open, or File ~ Recent.
    3. Hold Shift while opening your file.

    NB: This won't work by just selecting the Excel workbook to open.
    You need to open Excel first and then open the workbook.

    Edit:

    My concern is , that main function will send email out.

    Don't add your code to the Workbook_Open event, add it to the click event of a button instead - it'll never send out emails until you press the button then.