Excel 2003 - VBA - Ambigous Name Detected

  • Thread starter Thread starter Craig Brandt
  • Start date Start date
C

Craig Brandt

With code in Module 6, I created a button on a sheet as follows:
ActiveSheet.Buttons.Add(1245, 16, 80, 16).Select
Selection.Caption = "AutoFocus On"
Selection.Name = "AutoFocusBut"
Selection.OnAction = "FocusOn"
Focus = True

I placed the sub "FocusOn" also in Module 6.
Public Sub FocusOn()
If Focus = True Then
....
....

When the button is depressed I get the message: "Ambigous name detected:
FocusOn".

What am I missing.

Craig
 
My bet is you have two 'things' named FocusOn. Two subs or a sub and a
variable. Something like that.

--
Jim
| With code in Module 6, I created a button on a sheet as follows:
| ActiveSheet.Buttons.Add(1245, 16, 80, 16).Select
| Selection.Caption = "AutoFocus On"
| Selection.Name = "AutoFocusBut"
| Selection.OnAction = "FocusOn"
| Focus = True
|
| I placed the sub "FocusOn" also in Module 6.
| Public Sub FocusOn()
| If Focus = True Then
| ...
| ...
|
| When the button is depressed I get the message: "Ambigous name detected:
| FocusOn".
|
| What am I missing.
|
| Craig
|
|
 
Jim:
You hit the nail on the head! I had two procedures named FocusOn.
Thanks,
Craig
 
Back
Top