Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to reach Application Objects in Events?

Need to perform Range("A:A").Find operation in
ActiveSheet.Button1.OnClick event handler in module (not in a class!).
Button - member of the sheet. But, Application members seems to be
not visible for events until they specially declared (if I call event
handler as procedure it works).
Is there any common way to get any objects, visible in ordinal modules?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to reach Application Objects in Events?

Buttons from the forms toolbar (not the control toolbox toolbar) can have a
macro assigned to them from a general module. This is essentially a click
event, because it is fired when the control is clicked.

assume we assign the macro btn_click (any name can be chosen) to the button

Sub btn_click()
dim sName as string
dim btn as Button
sName = Application.Caller
set btn = activesheet.buttons(sName)
msgbox btn.Caption & ", " & btn.Name
End Sub

if not prompted, you can right click on the button and choose assign macro
from the popup menu.

--
Regards,
Tom Ogilvy




You can name the procedure anything, but once you rubberband the button
control on the spreadsheet, you will be prompted to assign a macro and it
will display a dialog similar to Tools=Macro=macros showing the
subroutines in general modules.
"NOPIK" wrote in message
ps.com...
Need to perform Range("A:A").Find operation in
ActiveSheet.Button1.OnClick event handler in module (not in a class!).
Button - member of the sheet. But, Application members seems to be
not visible for events until they specially declared (if I call event
handler as procedure it works).
Is there any common way to get any objects, visible in ordinal modules?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to reach Application Objects in Events?

Well... I know how to operate VB objects in common :-) More concrete:
I need to access objects outside of event visible range (but inside
the Application visible range).
Example: Application.MyOwnProperty visible for any module or class,
except events.
Can I access this property or method (may be, from other root of
Application object)?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to reach Application Objects in Events?

I don't know how you would make it visible to everything but events or why
you would want to.

But if you instantiate application.level events, you could use that class
module to hold your application level property.

http://www.cpearson.com/excel/appevent.htm

Even if you did this, however, it wouldn't be independent of a workbook -
you would still have to open and execute the code in a workbook to create
the property.

--
Regards,
Tom Ogilvy



"NOPIK" wrote in message
ps.com...
Well... I know how to operate VB objects in common :-) More concrete:
I need to access objects outside of event visible range (but inside
the Application visible range).
Example: Application.MyOwnProperty visible for any module or class,
except events.
Can I access this property or method (may be, from other root of
Application object)?



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
Application events ben Excel Programming 29 July 21st 05 04:12 PM
Application Events / App_WorkbookOpen Fries[_2_] Excel Programming 5 December 18th 04 01:21 PM
Mouse over events for Active X objects in excel Shrinu Excel Programming 1 May 26th 04 10:42 PM
Using Application Events Thomas Herr Excel Programming 2 April 5th 04 09:24 PM
structure of classes,objects,properties,methodes,events... Jan Eikeland Excel Programming 2 December 24th 03 10:49 AM


All times are GMT +1. The time now is 12:42 PM.

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"