Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Running Code in an XLA from a Worksheet

Thanks

Tom Ogilvy wrote
Application.Run "DaySheet.XLA!Module1!showdataentryform"





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running code on workdays chrisnsmith Excel Worksheet Functions 2 February 4th 09 06:58 PM
VB code for running a macro rcc Excel Discussion (Misc queries) 3 January 23rd 08 02:53 AM
Automatically running code Richard Excel Worksheet Functions 1 February 7th 06 09:35 PM
running code mark New Users to Excel 3 March 14th 05 09:14 AM
How to display status and keep code running ExcelMan Excel Programming 1 September 20th 03 04:31 AM


All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"