View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mimoran mimoran is offline
external usenet poster
 
Posts: 1
Default Call Excel Macro in VB.NET


I’m new to VB. Net and I’m trying to run an excel macro within a VB.Ne
Application
This is what I’m doing.
Open Excel Application with Macro (Personal.XLS)
Open New created Excel Book which needs to be formatted using macr
saved in Personal.XLS

I’m having problems calling the macro. Please help.

Here is my code

Dim objExcel As Ne
Microsoft.Office.Interop.Excel.ApplicationClass
Dim objExcel1 As Ne
Microsoft.Office.Interop.Excel.ApplicationClass

'open Personal Spreadsheet and make it visible
objExcel.Workbooks.Open("C:\PERSONALreports.XLS")
objExcel.Visible = True


'open Excel that needs to be formatted and make it visible t
user
objExcel1.Workbooks.Open("C:\Test.xls")
objExcel1.Visible = True

'run macro to format

objExcell2.ExecuteExcel4Macro("objExcell.ExecuteEx cel4MacroLate_Full")


'close open Access applications
objExcel.Quit()
objExcel1.Quit(

--
mimoranPosted from - http://www.officehelp.i