Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Correct Useage of .FindControls

You would only qualify myThing5 with Thisworkbook if myThing was declared
public in the Thisworkbook module, and Thisworkbook contains the running
code.

If the popup is only to be used in your userform I would create it as needed
and destroy it immediately after, eg

' userform code
Private myThing5 As Office.CommandBar

Private Sub CommandButton1_Click()
On Error Resume Next
Application.CommandBars("test2").Delete ' just in case
On Error GoTo 0

Set myThing5 = Application.CommandBars.Add("test2", msoBarPopup, , True)
With myThing5.Controls.Add(1, , , , True)
.Caption = "my Macro"
.Visible = True
'.OnAction = "myMacro"
' etc
End With

myThing5.ShowPopup

done:
On Error Resume Next
myThing5.Delete

Exit Sub
errH:
Resume done

End Sub

Regards,
Peter t


"pgag45" wrote in message
...
meh.. if I throw in a

Private Sub cmdShowMenu_Click()
On Error Resume Next
ThisWorkbook.myThing5.ShowPopup
End Sub

if the IDE is opened... it doesn't crash, it just doesn't work..



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
Excel 2003 - open work book useage agreement mbotfield Excel Worksheet Functions 3 September 23rd 09 04:53 PM
FindControls ID Bogdan Excel Programming 1 April 27th 07 09:00 PM
CPU useage at 100% on EXCEL.EXE Dave Patrick Excel Discussion (Misc queries) 0 January 1st 07 03:01 AM
IF Statement useage BThrasher Excel Discussion (Misc queries) 4 May 18th 06 03:21 PM
MsgBox Useage Jeff[_24_] Excel Programming 2 November 7th 03 01:08 PM


All times are GMT +1. The time now is 11:14 PM.

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

About Us

"It's about Microsoft Excel"