#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default User Form

WIN2K Excel 2000
===========================

I have a VB form I created that loads and functions perfectly on the
opening of the workbook.

What I need know is a way for the user to invoke the form at will from
the menu or toolbar. How ???

Thanks !!!

Craig
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default User Form

Try this:

Sub AddToolbar()
Const cFormName = "MyForm"
Dim ctlTemp As CommandBarControl

On Error Resume Next
With CommandBars.ActiveMenuBar
Set ctlTemp = .Controls(cFormName)
If Err < 0 Then
Err.Clear
With .Controls.Add(msoControlButton, , ,
..Controls("&Help").Index, True)
.Style = msoButtonCaption
.Caption = cFormName
.OnAction = "RunMyForm"
End With
End If
End With
End Sub

Sub RunMyForm()
MsgBox "ToDo: Running Code Here"
End Sub



"Craig Somberg" wrote in message
...
WIN2K Excel 2000
===========================

I have a VB form I created that loads and functions perfectly on the
opening of the workbook.

What I need know is a way for the user to invoke the form at will from
the menu or toolbar. How ???

Thanks !!!

Craig



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User Form

Create a button on toolbar or on the sheet itself, and add code
"UserForm.Show" substituting the name of your form for UserForm
"Craig Somberg" wrote in message
...
WIN2K Excel 2000
===========================

I have a VB form I created that loads and functions perfectly on the
opening of the workbook.

What I need know is a way for the user to invoke the form at will from
the menu or toolbar. How ???

Thanks !!!

Craig



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default User Form

I have these routines setup and I keep getting the error:

The macro 'NameOfWorkBook.xls!ShowExtractorForm' cannot be found.

Any clues ?

This code is in the WorkBook, not a module or worksheet.

Thanks.

Craig


Private Sub Add_E_ToolBar()

Dim cb As CommandBar
Dim mnu As CommandBarControl
Dim iIndex As Integer

Set cb = Application.CommandBars("Worksheet Menu Bar")

' does the menu item exist already?
On Error Resume Next
iIndex = cb.Controls("Craig").Index
If Err < 0 Then
Err.Clear
Else
Set cb = Nothing
Exit Sub
End If

' if we are here we need to create everything
iIndex = cb.Controls("Help").Index
Set mnu = cb.Controls.Add(Type:=msoControlPopup, Befo=iIndex)

With mnu
.Caption = "Craig"
.OnAction = "ShowExtractorForm"
End With

Set cb = Nothing

End Sub


Private Sub ShowExtractorForm()

frmExtractData.Show

End Sub





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
user form Ruth Excel Discussion (Misc queries) 3 October 30th 08 12:51 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
user form hngo New Users to Excel 2 July 13th 05 11:48 PM
user form static69 Excel Discussion (Misc queries) 1 February 6th 05 08:43 PM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM


All times are GMT +1. The time now is 02:23 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"