Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Prompt User to Select Macro to Run?

Is it possible to have a macro run that prompts the user to select which
macro to run? If so, how would that be coded?

The situation:

I am creating a workbook that will guide the user to create a "template"
(not as a literal file, but in the sense that this will be the starting
workbook), which the user will be prompted to save as another file name (this
will be their personal template for their class). Since I am creating this
for teachers who are not familiar with macros, I would like to store the
various macros I have written in one workbook, and then prompt the user to
select which macro to run, depending on what they want to do...

help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Prompt User to Select Macro to Run?

Excel 2003
menu bar example

1) cut/paste this to a standard code module.
2)call AddMenuItems
this adds "Test" as a menu item immediately left of "Help" om the
standard worksheet menu bar




Option Explicit
Sub AddMenuItems()
Dim cbMain As CommandBar
Dim ctrl As CommandBarPopup
RemoveMenuItems "Tes&t"
Set cbMain = CommandBars("Worksheet Menu Bar")
With cbMain.Controls.Add(msoControlPopup, Befo=cbMain.Controls.Count,
Temporary:=True)
.Caption = "Tes&t"
With .Controls.Add(msoControlButton)
.OnAction = "ABC"
.Caption = "ABC"
End With
With .Controls.Add(msoControlButton)
.OnAction = "DEF"
.Caption = "DEF"
End With
End With
End Sub
Sub RemoveMenuItems(sMenu As String)
Dim mn As CommandBarControl
On Error GoTo quit
Set mn = CommandBars("Worksheet Menu Bar").Controls("tes&t")
Do While Not mn Is Nothing
mn.Delete
Set mn = CommandBars("Worksheet Menu Bar").Controls("tes&t")
Loop
quit:
On Error GoTo 0
End Sub
Sub ABC()
MsgBox "ABC running"
End Sub
Sub DEF()
MsgBox "DEF running"
End Sub


"Patrick Molloy" wrote in message
...
you could create your own menu / ribbon

"SeventhFloorProfessor"
wrote in message
...
Is it possible to have a macro run that prompts the user to select which
macro to run? If so, how would that be coded?

The situation:

I am creating a workbook that will guide the user to create a "template"
(not as a literal file, but in the sense that this will be the starting
workbook), which the user will be prompted to save as another file name
(this
will be their personal template for their class). Since I am creating
this
for teachers who are not familiar with macros, I would like to store the
various macros I have written in one workbook, and then prompt the user
to
select which macro to run, depending on what they want to do...

help!


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
Prompt User to Select Macro to Run? joel Excel Programming 1 May 15th 09 05:00 PM
Prompt User to Select Macro to Run? Patrick Molloy Excel Programming 0 May 15th 09 04:34 PM
Prompt User to Select Macro to Run? Jon Peltier Excel Programming 0 May 15th 09 04:30 PM
Prompt user to select a range Aaron Dyck Excel Programming 2 October 31st 08 02:06 AM
Prompt user to select a printer using a checkbox within a user Tom Ogilvy Excel Programming 0 January 10th 07 03:57 AM


All times are GMT +1. The time now is 07:53 AM.

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

About Us

"It's about Microsoft Excel"