ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I may have found (yet another) bug in Excel (https://www.excelbanter.com/excel-programming/287504-i-may-have-found-yet-another-bug-excel.html)

DennisE

I may have found (yet another) bug in Excel
 
I have assigned a HelpContextID to all TextBoxes in my Excel 2002
program, and my home-crafted help system works perfectly. When
I tried to do the same for their corresponding Labels, Excel bombed.
Would some of you set up the following very simple experiment to
confirm what I've encountered (or explain what I'm doing wrong):

Set up UserForm1 with three controls: Label1, TextBox1, and
CommandButton1. In the Properties module set the HelpContextID
for TextBox1 to 101 and the HelpContextID for Label1 to 102, say.
In the code module do the following:

Private Sub CommandButton1_Click()
MsgBox UserForm1.TextBox1.HelpContextID
MsgBox UserForm1.Label1.HelpContextID
End Sub

Sub Auto_Open()
UserForm1.Show
End Sub

Load the program and click the command button. A message
box comes up with the number 101 displayed, as it should;
dismiss the message box and then what happens to me is
that an error message comes up saying "Member not found."

-- Dennis Eisen

Bob Phillips[_6_]

I may have found (yet another) bug in Excel
 
Dennis,

I get the same results, and a search on Google also suggest that you cannot
write to the property at run-time. So read/write at run time seems a no-no.

It does seem to be a bug, but to me the bug is that there is a HelpContextId
at all. As a label cannot take focus, you cannot do an F1 Help on a label,
so having HelpContexId seems redundant.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"DennisE" wrote in message
...
I have assigned a HelpContextID to all TextBoxes in my Excel 2002
program, and my home-crafted help system works perfectly. When
I tried to do the same for their corresponding Labels, Excel bombed.
Would some of you set up the following very simple experiment to
confirm what I've encountered (or explain what I'm doing wrong):

Set up UserForm1 with three controls: Label1, TextBox1, and
CommandButton1. In the Properties module set the HelpContextID
for TextBox1 to 101 and the HelpContextID for Label1 to 102, say.
In the code module do the following:

Private Sub CommandButton1_Click()
MsgBox UserForm1.TextBox1.HelpContextID
MsgBox UserForm1.Label1.HelpContextID
End Sub

Sub Auto_Open()
UserForm1.Show
End Sub

Load the program and click the command button. A message
box comes up with the number 101 displayed, as it should;
dismiss the message box and then what happens to me is
that an error message comes up saying "Member not found."

-- Dennis Eisen




DennisE

I may have found (yet another) bug in Excel
 
Thanks much for responding to my inquiry. It is true
enough that a label cannot take a focus and hence no way to
summon help by pressing the <F1 key. What I was trying to do
is to develop my own help system wherein by clicking on the
label, a call to my own help subroutine, say HelpMe (N), would be
issued with the label's HelpContextID parameter serving to identify
where the call came from. For example,

Sub UserForm1.Label1_Click()
HelpMe UserForm1.Label1.HelpContextID
End Sub

As is now verified, that won't work, so my workaround
has been to simply to change the code to read:

Sub UserForm1.Label1_Click()
HelpMe UserForm1.TextBox1.HelpContextID
End Sub

In this manner, users can bring up a help screen in
either of two ways: by pressing <F1 while the
insertion point is in the TextBox (as it has the focus),
or by clicking on the label next to the TextBox. The
coding is very easy as I've made sure that all TextBoxes
and their corresponding Labels are similarly named
(that is Label34 goes with TextBox34, etc.).

-- Dennis Eisen

onedaywhen

I may have found (yet another) bug in Excel
 
How about using another control, one with a HelpContextID you can
actually use, and make it look like a label?

--

(DennisE) wrote in message ...
Thanks much for responding to my inquiry. It is true
enough that a label cannot take a focus and hence no way to
summon help by pressing the <F1 key. What I was trying to do
is to develop my own help system wherein by clicking on the
label, a call to my own help subroutine, say HelpMe (N), would be
issued with the label's HelpContextID parameter serving to identify
where the call came from. For example,

Sub UserForm1.Label1_Click()
HelpMe UserForm1.Label1.HelpContextID
End Sub

As is now verified, that won't work, so my workaround
has been to simply to change the code to read:

Sub UserForm1.Label1_Click()
HelpMe UserForm1.TextBox1.HelpContextID
End Sub

In this manner, users can bring up a help screen in
either of two ways: by pressing <F1 while the
insertion point is in the TextBox (as it has the focus),
or by clicking on the label next to the TextBox. The
coding is very easy as I've made sure that all TextBoxes
and their corresponding Labels are similarly named
(that is Label34 goes with TextBox34, etc.).

-- Dennis Eisen



All times are GMT +1. The time now is 08:02 AM.

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