Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Serious Macro Menu Help

Serious Macro Menu Help

I have been frustrasted for a month or so trying to create an Excel Menu
macro.
1. Macro opens a popup menu with a list of terms for expenses. By scrolling
down, I need each term when selected to refer to a submenu with terms.
2. Once name is selected the macro inputs the text in a cell, moves over one
cell to input the kind of expense, then moves over to next cell to allow
input by the user of the amount.
3. After User entering Amount the macro moves back (left) 2 cells and
down 1 row. Ready for next expense.
PS If this is asking too much then A. Where do I find how to create a popup
menu with terms? B. How do I stop a macro and allow user input?
Thanks in Advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Serious Macro Menu Help

On 13 Jan., 01:36, TexYankee
wrote:
Serious Macro Menu Help

I have been frustrasted for a month or so trying to create an Excel Menu
macro.
1. Macro opens a popup menu with a list of terms for expenses. *By scrolling
down, I need each term when selected to refer to a submenu with terms. *
2. Once name is selected the macro inputs the text in a cell, moves over one
cell to input the kind of expense, then moves over to next cell to allow
input by the user of the amount.
3. After User entering Amount the macro moves back (left) 2 cells and
down 1 row. Ready for next expense.
PS If this is asking too much then A. Where do I find how to create a popup
menu with terms? B. How do I stop a macro and allow user input?
Thanks in Advance


Hi
Use a Inputbox to allow the user to enter data.

Answer = Inputbox("Enter amount ", "Header")

Have a look at this. Note OnAction = "MyMacro" call a macro named
MyMacro.

Public Const APPNAME As String = "Expenses"
Dim MyMenuBar As CommandBar
Dim cbPop As CommandBarControl
Dim cbCtl As CommandBarControl
Dim cbSub As CommandBarControl

Sub CreatePopupMenu()
On Error Resume Next
'Application.CommandBars(APPNAME).Delete ' Delete old menu with
same name

'Create MenuBar
Set MyMenuBar = Application.CommandBars.Add(APPNAME,
Position:=msoBarTop, temporary:=False)
MyMenuBar.Visible = True


' Create a popup control
Set cbPop =
Application.CommandBars(APPNAME).Controls.Add(Type :=msoControlPopup)
cbPop.Caption = APPNAME
cbPop.Visible = True

'---------------------------------------------------------
' PopUpMenu items
'------------------------------------------------


Set cbCtl = cbPop.Controls.Add(Type:=msoControlButton)
With cbCtl
.Visible = True
.Style = msoButtonCaption
.Caption = "&Expenses 1"
.OnAction = "Expenses1" ' Call macro when selected
End With

Set cbCtl = cbPop.Controls.Add(Type:=msoControlButton)
With cbCtl
.Visible = True
.Style = msoButtonCaption
.Caption = "E&xpenses 2"
.OnAction = "Expenses2" ' Call macro when selected
End With

'-------------------------------------------------
' SubMenu
'------------------------------------------------

Set cbSub = cbPop.Controls.Add(Type:=msoControlPopup)
With cbSub
.Visible = True
.Caption = "&Terms1"
End With

Set cbCtl = cbSub.Controls.Add(Type:=msoControlButton)
With cbCtl
.Visible = True
.Caption = "Ex&penses 3"
.OnAction = "Expenses3" ' Call macro when selected
End With
End Sub

Regards,

Per

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Serious Macro Menu Help

Thanks I am anxious to put your suggestions to work.

"Per Jessen" wrote:

On 13 Jan., 01:36, TexYankee
wrote:
Serious Macro Menu Help

I have been frustrasted for a month or so trying to create an Excel Menu
macro.
1. Macro opens a popup menu with a list of terms for expenses. By scrolling
down, I need each term when selected to refer to a submenu with terms.
2. Once name is selected the macro inputs the text in a cell, moves over one
cell to input the kind of expense, then moves over to next cell to allow
input by the user of the amount.
3. After User entering Amount the macro moves back (left) 2 cells and
down 1 row. Ready for next expense.
PS If this is asking too much then A. Where do I find how to create a popup
menu with terms? B. How do I stop a macro and allow user input?
Thanks in Advance


Hi
Use a Inputbox to allow the user to enter data.

Answer = Inputbox("Enter amount ", "Header")

Have a look at this. Note OnAction = "MyMacro" call a macro named
MyMacro.

Public Const APPNAME As String = "Expenses"
Dim MyMenuBar As CommandBar
Dim cbPop As CommandBarControl
Dim cbCtl As CommandBarControl
Dim cbSub As CommandBarControl

Sub CreatePopupMenu()
On Error Resume Next
'Application.CommandBars(APPNAME).Delete ' Delete old menu with
same name

'Create MenuBar
Set MyMenuBar = Application.CommandBars.Add(APPNAME,
Position:=msoBarTop, temporary:=False)
MyMenuBar.Visible = True


' Create a popup control
Set cbPop =
Application.CommandBars(APPNAME).Controls.Add(Type :=msoControlPopup)
cbPop.Caption = APPNAME
cbPop.Visible = True

'---------------------------------------------------------
' PopUpMenu items
'------------------------------------------------


Set cbCtl = cbPop.Controls.Add(Type:=msoControlButton)
With cbCtl
.Visible = True
.Style = msoButtonCaption
.Caption = "&Expenses 1"
.OnAction = "Expenses1" ' Call macro when selected
End With

Set cbCtl = cbPop.Controls.Add(Type:=msoControlButton)
With cbCtl
.Visible = True
.Style = msoButtonCaption
.Caption = "E&xpenses 2"
.OnAction = "Expenses2" ' Call macro when selected
End With

'-------------------------------------------------
' SubMenu
'------------------------------------------------

Set cbSub = cbPop.Controls.Add(Type:=msoControlPopup)
With cbSub
.Visible = True
.Caption = "&Terms1"
End With

Set cbCtl = cbSub.Controls.Add(Type:=msoControlButton)
With cbCtl
.Visible = True
.Caption = "Ex&penses 3"
.OnAction = "Expenses3" ' Call macro when selected
End With
End Sub

Regards,

Per


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
Old Menu Macro oldjay Setting up and Configuration of Excel 1 December 15th 09 08:06 PM
Macro in Menu Zainuddin Excel Discussion (Misc queries) 1 June 28th 09 11:21 AM
MACRO MENU REDANDY Excel Discussion (Misc queries) 5 October 26th 07 01:10 AM
Macro Menu Sam Excel Programming 1 June 7th 07 04:59 PM
How to get a vba macro to show up in the macro menu JacksonRJones Excel Programming 3 May 12th 06 02:11 AM


All times are GMT +1. The time now is 05:41 PM.

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"