Macro gets disabled if called using a vb script

前端 未结 2 605
Happy的楠姐
Happy的楠姐 2021-01-13 03:22

I am trying to call my excel macro using vbs. Here is a snippet of my code.

Set objExcel = CreateObject(\"Excel.Application\")
Set objWorkbook = objExcel.W         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-13 03:55

    To add to Siddhart's answer - you can load the addins you require in a VBScript like this:

    objExcel.RegisterXLL("analys32.xll") 'For XLL addins
    objExcel.Workbooks.Open(objExcel.LibraryPath & "\analysis\atpvbaen.xla") 'For standard XLA addins
    objExcel.Workbooks.Open("C:\Program Files\MyAddins\MyAddin.xla") 'for custom XLA addins
    

提交回复
热议问题