Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
I have a button on a worksheet and want it to run code in
an XLA - how do I do this? TIA. Chrissy. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
Use a button from the forms toolbar and then right click on it and choose
assign macro MyXLA.xls!MyMacro You will have to type it in. Assumes the XLA is open. -- Regards, Tom Ogilvy Chrissy wrote in message ... I have a button on a worksheet and want it to run code in an XLA - how do I do this? TIA. Chrissy. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
Thanks.
I was trying to do something like this. Sub CommandButton1_Click() Dim XLAFound As Boolean Dim i As Integer XLAFound = False For i = 1 To AddIns.Count If AddIns(i).Name = "DaySheet.xla" Then XLAFound = True End If Next If XLAFound Then AddIns("DaySheet.XLA").Installed = True Else AddIns.Add(Filename:=ThisWorkbook.Path & "/" & "DaySheet.XLA", CopyFile:=True).Installed = True End If Application.ExecuteMacro "DaySheet.XLA!Module1!showdataentryform" End Sub And attaching it to the button - which of course, does not work. I was trying to call the macro from code so I could make sure the XAL was loaded first. Is this possible? Chrissy. "Tom Ogilvy" wrote in message ... Use a button from the forms toolbar and then right click on it and choose assign macro MyXLA.xls!MyMacro You will have to type it in. Assumes the XLA is open. -- Regards, Tom Ogilvy Chrissy wrote in message ... I have a button on a worksheet and want it to run code in an XLA - how do I do this? TIA. Chrissy. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
Application.Run "DaySheet.XLA!Module1!showdataentryform"
-- Regards, Tom Ogilvy Chrissy wrote in message ... Thanks. I was trying to do something like this. Sub CommandButton1_Click() Dim XLAFound As Boolean Dim i As Integer XLAFound = False For i = 1 To AddIns.Count If AddIns(i).Name = "DaySheet.xla" Then XLAFound = True End If Next If XLAFound Then AddIns("DaySheet.XLA").Installed = True Else AddIns.Add(Filename:=ThisWorkbook.Path & "/" & "DaySheet.XLA", CopyFile:=True).Installed = True End If Application.ExecuteMacro "DaySheet.XLA!Module1!showdataentryform" End Sub And attaching it to the button - which of course, does not work. I was trying to call the macro from code so I could make sure the XAL was loaded first. Is this possible? Chrissy. "Tom Ogilvy" wrote in message ... Use a button from the forms toolbar and then right click on it and choose assign macro MyXLA.xls!MyMacro You will have to type it in. Assumes the XLA is open. -- Regards, Tom Ogilvy Chrissy wrote in message ... I have a button on a worksheet and want it to run code in an XLA - how do I do this? TIA. Chrissy. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
Thanks
Tom Ogilvy wrote Application.Run "DaySheet.XLA!Module1!showdataentryform" |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
Actually, it should be
Application.Run "DaySheet.XLA!Module1.showdataentryform" Didn't notice you you had a ! between the module and macro names. -- regards Tom Ogilvy Chrissy wrote in message ... Thanks Tom Ogilvy wrote Application.Run "DaySheet.XLA!Module1!showdataentryform" |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code in an XLA from a Worksheet
Oops - me either - that was a typo.
I even read your post the way you meant to write it and not what you wrote. Chrissy. Tom Ogilvy wrote Actually, it should be Application.Run "DaySheet.XLA!Module1.showdataentryform" Didn't notice you you had a ! between the module and macro names. -- regards Tom Ogilvy Chrissy wrote in message ... Thanks Tom Ogilvy wrote Application.Run "DaySheet.XLA!Module1!showdataentryform" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Running code on workdays | Excel Worksheet Functions | |||
VB code for running a macro | Excel Discussion (Misc queries) | |||
Automatically running code | Excel Worksheet Functions | |||
running code | New Users to Excel | |||
How to display status and keep code running | Excel Programming |