schnabs
Technical User
- Jan 21, 2009
- 50
Hello,
I am using Visual Basic 2008 to open an excel sheet. I want to run a macro from a separate sheet, as I don't want clients having access to running it, as well as most clients have macros disabled and it throws an error when they open it. Anyways, my code looks OK I think..
Dim oxl As Microsoft.Office.Interop.Excel.Application
Dim oxlbook As Microsoft.Office.Interop.Excel.Workbook
oxl = New Microsoft.Office.Interop.Excel.Application
oxlbook = oxl.Workbooks.Open("C:\Documents and Settings\Bob\Desktop\Book8.xls")
oxl.Visible = True
oxl.Run("C:\Documents and Settings\Bob\Desktop\Book5.xla!DelinqNormal()")
I have read around that when you automate Excel through VB, it doesn't load the add-ins required to run Macros. I cannot, however, find the code necessary to load the add-ins, or which ones to load. Any help would be great!
Thanks!
I am using Visual Basic 2008 to open an excel sheet. I want to run a macro from a separate sheet, as I don't want clients having access to running it, as well as most clients have macros disabled and it throws an error when they open it. Anyways, my code looks OK I think..
Dim oxl As Microsoft.Office.Interop.Excel.Application
Dim oxlbook As Microsoft.Office.Interop.Excel.Workbook
oxl = New Microsoft.Office.Interop.Excel.Application
oxlbook = oxl.Workbooks.Open("C:\Documents and Settings\Bob\Desktop\Book8.xls")
oxl.Visible = True
oxl.Run("C:\Documents and Settings\Bob\Desktop\Book5.xla!DelinqNormal()")
I have read around that when you automate Excel through VB, it doesn't load the add-ins required to run Macros. I cannot, however, find the code necessary to load the add-ins, or which ones to load. Any help would be great!
Thanks!