ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling an embedded items event procedure from within a normal module (https://www.excelbanter.com/excel-programming/331247-calling-embedded-items-event-procedure-within-normal-module.html)

jase[_2_]

Calling an embedded items event procedure from within a normal module
 
Trying to call the event procedure "Private Sub TxtString_GotFocus()"
from with a normal module in the same workbook.

The event procedure is for a textbox that is embedded in Sheet4 so the
event procedure is within the class module connected to Sheet4

Must be quite easy, but keeps throwing an error for me

Help greatly appreciated
Jason


Chip Pearson

Calling an embedded items event procedure from within a normal module
 
The following code works for me just fine in Excel 2003.

Private Sub TextBox1_GotFocus()
MsgBox "GotFocus"
End Sub

What specific error are you seeing?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"jase" wrote in message
oups.com...
Trying to call the event procedure "Private Sub
TxtString_GotFocus()"
from with a normal module in the same workbook.

The event procedure is for a textbox that is embedded in Sheet4
so the
event procedure is within the class module connected to Sheet4

Must be quite easy, but keeps throwing an error for me

Help greatly appreciated
Jason




Tom Ogilvy

Calling an embedded items event procedure from within a normal module
 
You need to declare it as public and then use

Sheet4!TxtString_GotFocus

to call it from the normal module.

--
Regards,
Tom Ogilvy


"jase" wrote in message
oups.com...
Trying to call the event procedure "Private Sub TxtString_GotFocus()"
from with a normal module in the same workbook.

The event procedure is for a textbox that is embedded in Sheet4 so the
event procedure is within the class module connected to Sheet4

Must be quite easy, but keeps throwing an error for me

Help greatly appreciated
Jason




jase[_2_]

Calling an embedded items event procedure from within a normal module
 
just to be pedantic Tom (as I'm sure it was just a little typo) but the
code that worked was:

Sheet4.TxtString_GotFocus

Thanks again
Jason

Tom Ogilvy wrote:
You need to declare it as public and then use

Sheet4!TxtString_GotFocus

to call it from the normal module.

--
Regards,
Tom Ogilvy


"jase" wrote in message
oups.com...
Trying to call the event procedure "Private Sub TxtString_GotFocus()"
from with a normal module in the same workbook.

The event procedure is for a textbox that is embedded in Sheet4 so the
event procedure is within the class module connected to Sheet4

Must be quite easy, but keeps throwing an error for me

Help greatly appreciated
Jason




All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com