View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chrissy[_4_] Chrissy[_4_] is offline
external usenet poster
 
Posts: 101
Default 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.