PDA

Click to See Complete Forum and Search --> : a Sub in Excell


R@emdonck
Dec 10th, 1999, 09:02 PM
Hello,

How can I activate a "Sub" (the sub is located in a module) in an Excell workbook with a vb5 aplication.


for example:


this is Sub in Excell

Sub print_plan()

Call dbShopOrder.SearchOrders
Worksheets("plan").Activate
ActiveSheet.PrintOut

End Sub

greetings R@emdonck

[This message has been edited by R@emdonck (edited 12-11-1999).]

Al Smith
Dec 10th, 1999, 10:27 PM
Here's a VB sub I use to run an Excel sub routine. All of my Excel modules are in an Excel sheet named "Macros". This one runs
Sub LocValue().
Al.

Sub DataToExcel()
Set XLsheet = GetObject("c:\excel.xls\Macros.xls")
XLsheet.Application.Visible = True
XLsheet.Parent.Windows(1).Visible = True
XLsheet.Activate
XLsheet.Application.Run "'Macros.xls'!LocValue"
XLsheet.Application.Quit
Set XLsheet = Nothing
Exit Sub
End Sub