View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter Huang Peter Huang is offline
external usenet poster
 
Posts: 115
Default Application.Run with multiple workbooks

Hi,

What do you mean by compiling the code into dll?
Do you mean make a com addin dll, and invoke the macro from the com addin?

I have tried to make an addin in VB6 and call a similar macro with optional
parameter, it seems to run smoothly on my side.
Here is the code I run from the addin
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
On Error GoTo error_handler
Set exApp = Application
exApp.Visible = True
exApp.Workbooks.Open "c:\book1.xls"
exApp.Workbooks.Open "c:\book2.xls"
exApp.Run "Book1.xls!Test", "LocalPrinter", 1
exApp.Run "Book2.xls!Test", "LocalPrinter", 2
Exit Sub
error_handler:
MsgBox Err.Description
End Sub

If I have any misunderstanding, please feel free to let me know.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.