Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: VB Run Excel Automation without running Macro


Message #1 by <asurachman@y...> on Tue, 16 Jan 2001 09:53:24 -0800
Dear All,

I do beg your help.

Is there a way to cancel Excel Macro (sub Workbook_Open etc) executed when
it is running under our VB (VBA) codes?

I've set Excel Tools - Macro - Security - Security Level : High
but there's seems has no effect to the Excel Automation.

I've tried like this:

Sub RunEx()
    On Error Resume Next
    Dim xl As Excel.Application
    Dim wb As Workbook

    Set xl = New Excel.Application

    'Note untuk password
    xl.DisplayAlerts = False
    xl.EnableEvents = False

    Debug.Print xl.EnableEvents  'return False

    Set wb = xl.Workbooks.Open("C:\My Documents\My Data\Excel\Bill
Them.xls")

    'This file contains macro in Workbook_Open,
'and the macro is executed!

    Debug.Print xl.EnableEvents     'reutrn true --amazing!

    xl.quite
    set xl = nothing

End sub


Please your help.

best Regards,
-Agus





  Return to Index