Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




New Menu Item


How do I insert a new menu item in Excel with wich a Visual Basic macro will be launched?I will this new menu item to appear in Excel's menu only when the file containing the VB macro isopen.I'm using XL97 and VB 5.0.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Add Menu Item And Sub Menu Item In Outlook
Hi
I Am Developing One Application During This Application I Am Facing One Problem.what Is That Is, I Am Explaining Every Thing Clearly.in Outlook For Example One tool Menu Item Is There In This Menu Item I Want Add One Menu Item Example mailitem.in This mailitem,i Want Add Another Two Sub Menu Items Example These Names Are mailsend And mailrecieve .
How This Shoulb Be Done In Vb6?this Is Very Urgent.
Any One Knows Please Replay Immediatly.

Add Menu Item To System Menu Of Excel Imported Form [SOLVED]
I'm trying to achieve above 2 items but can't find out how. I've searched this forum already but also can't find anything relevant so am hoping that some of you might be able to kick me in the right direction.

I'm creating a combined VB6 and excel application. Basically VB6 controls excel. The forms used are imports from existing excel applications where I didn't feel like recreating them all over again. Part from that, the excel tab control is way better and easier to use then the VB6 one.

Progress timer:
When starting the program I want to show a progress timer because the program needs to initialize many items and arrays used. I thus created a simple progress timer which depending makes certain pictures visible which form a simple progress bar. The timer used is the VB6 timer option since there's nothing relevant like that from excel. This works well in itself but the problem is with display of the timer. During start it shows the form on which it was created but the timer only starts working after all has been initialized which basically defeats its purpose. Does anybody have any idea how to conquer this one.

Add item to top left window menu:
I want to add a About option to the top / left menu of my program window, the one also containing the minimize and maximize options. I've seen it done in other programs and since it is the only menu item I need I would prefer to do it this way also. I can't however find any information on how to go about this. Hope that someone can give me a push in the right direction for this one as well.

Thanks in advance for any suggestions.

Best regards,

Leon

Remove Item From Menu And Add Code To Dynamic Menu Items
Hi.
I build my menu dynamically from a recordset.

Code:
While Not listTypes.EOF
Load mnufiles(mnufiles.UBound + 1)
With mnufiles(mnufiles.UBound)
.Caption = listTypes.Fields(1)
.Enabled = True
.Visible = True
.Checked = True
End With
listTypes.MoveNext
Wend


What happens is that i've got this menu, by default with one item (the first).
I wan't to remove it because it doesn't matter anymore after loading fields from DB.
How can I do this?

Another question:
How do I associate code to the dynamically generated menu items?
Thanks.

Adding Image To A Menu-item Thro Menu Editor
Hello,

Is it possible to add an image to menu-item thro Menu Editor in VB 6.0?

Thanks

Add Custom Menu Item To Windows Right Click Context Menu ????
Hi everyone

Earlier today there was a thread with this Q in it but it wasnt ever resolved. What i want to do is add my own custom entry to the windows menu that pops up when you right click on an something in particular to the edit menu. So when you select some text no matter what app your in it has my custom menu option in it along with the usual copy and paste and what not.

Can this be done

If so how and where do i start ??

Disable The Save Menu Item In The File Menu For Excel .
Hi all,
Please let me know how to disable the save menu item in the file menu when a excel sheet is opened.

How To Add A Menu Item To The Windows Explorer Popup Menu?
Hi,

I have a feeling that this is going to be an API question, but I thought I start with this forum first..

Basically, what I want to do is to create a little VB app which I can launch by using the popup menu in the Windows Explorer. When I right-click on a folder, I want to be able to launch my program.

Any examples and ideas on how to do this would be greatly appreciated..

Dan

How To Add Menu Item To The Windows Explorer Context Menu Using Vb6
Hi,

Can anyone please let me know,
How to add my application item "Run My application" to the windows explorer context menu and on right click-> click on this item , i need to run my application. How can i do this using VB6? its exactly like winzip and other programs doing. First thing is i want to add to the context menu of windows explorer and on click my item, i need to know on whick item user selected this option. I need to do this in VB6. Please help me in this regard.

thanking you

Praveen

In A Popup Menu Witch Menu Item Is Slected
How do I find out what menu item was clicked

str = popMenu.Name
Select Case str
Case "mCut"
MsgBox "cut"
Case "mPaste"
MsgBox "paste"
Case "mProperties"
MsgBox "pro"

End Select

Add Menu Item To Context Menu
How can I add a sub menu to the popup menu that you get when you right-click the desktop (similar to the attached picture)?

Menu Item
Hi All,

I have a menu item and once clicked adds a form (form1) to the window, how do I get it so that when it is clicked again it adds another form (form2) to the window?

Thanks

Loftty

Menu Item
How do I disable a menu item?

New Menu Item
I'm trying to create a menu item on the menu bar that will open a specific folder where templates are loacted. When the user selects the template to use and hits ok the application should run the template the same way it would if you went through File | New in the menu bar.

Any ideas on how to go about this. I would think that writing a macro to do the opening of the folder and the selection of the template would be the way to go, then just tie that macro to the menu item. How would I go about writing the code for the macro to accomplish this.

Any ideas would be helpful.

Add Menu Item
Could somebody tell me how to add sub-menu items to Excel? Here's what I have so far:

<pre>
Sub AddMenuItem()

Dim myMenu As CommandBarButton, RunProgram As Object, Pos As Integer

Pos = CommandBars("Worksheet Menu Bar").Controls.Count

Set myMenu = CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControlButton, Before:=Pos, Temporary:=True)

With myMenu
.Caption = "Testing"
.Enabled = True
.Style = msoButtonCaption
.Visible = True
.OnAction = "HelloWorld"
End With

End Sub


</pre>

This creates a new menu item to the left of Help named "Testing", but how do I add submenus to that?

"The face of a child can say it all, especially the mouth part of the face." - Jack Handy
<P ID="edit"><FONT class="small"><EM>Edited by Mill on 08/31/01 03:55 PM.</EM></FONT></P>

Menu Item
is there a way to add a menu item with code? like.. when the program is already running. at load time i want my program to browse through it's registry settings for certin values and if it finds them i want it to put a menu item under a preexisting menu that i created in the menu editer. if this makes any sence and you knwo what i mean please respond. thanks in advance

Menu Item
Dear VF users

Can any body explain the diffrent between the 'itemData' & 'itemid' of MEASUREITEMSTRUCT.

Because the followin description of 'ItemData' in MSDN is not clear for me.

description : Specifies the application-defined 32-bit value associated with the menu item.

* Above subject related to Owner Drawn Menu if your not sure.

Menu Item
hey all here's the problem i am having...............i have this program that has the menu at the top but when i load the form i want some of them to not be visible but when ever i type code in for it won't let me for example the one menu's name is cmdconnect2 and go to type cmdconnect2.visible = false
and it only lets me type cmdconnect2.count or cmdconnect2.item or cmdconnect2.LBound or cmdconnect2.UBound...................i'm not very familiar with menus can anyone help??

Menu Item
I am making a kind of web browser and am wondering if there is a way to add this to a menu and save it there...
so you click add to favorites
and this stores the page
thanks!

Sub Menu Item?
Hey,

mnuMain
....mnuOpen

In the code below, I can get the height of the main menu, and the
.left position of the text.  If you click on mnuMain, the first item is
mnuOpen.   Here's the question...

How can I retrieve the same information for mnuOpen as I did
for mnuMain?

CODEPrivate Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Private Type DRAWITEMSTRUCT
        CtlType As Long
        CtlID As Long
        itemID As Long
        itemAction As Long
        itemState As Long
        hwndItem As Long
        hdc As Long
        rcItem As RECT
        itemData As Long
End Type

Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" _
(ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, _
ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Private Declare Function GetMenu Lib "user32" (ByVal Hwnd As Long) As Long
Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function GetMenuItemRect Lib "user32" (ByVal Hwnd As Long, _
ByVal hMenu As Long, ByVal uItem As Long, lprcItem As RECT) As Long

Private Sub Form_Load()
    Dim lngMenu As Long
    Dim lngSubMenu As Long
    Dim rcItem As RECT
    
    'get menu handle
    lngMenu = GetMenu(Me.Hwnd)
    
    'get rectangle for the first item of the menu
    Call GetMenuItemRect(Me.Hwnd, lngMenu, 0, rcItem)

    'height of first item in pixels
    Label1.Caption = rcItem.Bottom - rcItem.Top
    Label2.Caption = rcItem.Left
End Sub

Do Menu Item
Do Menu Item...
The do menu Item in Access 2000 does not appear to give access to other items on my took bar, like, "Format, "Tools", etc...

AcFile, AcEditMen, and AcRecordsMenu appears to be the only Items available from the Menu bar using vb code
 
(DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70)

Am I missing something. Does anyone out there have an idea how I can give, "My Lazy Users" a single command to say "Unhide" or to "Hide" columns on a form.
Link

F1 At Menu Item
Hi,
I need to activate chm file page when the user press F1 at the menu bar.
How can i do this.


Thanks,

F1 At Menu Item
Hi Gurus,
I need to display relevent chm file when user press F1 at the menu item.There is no key press event to hanlde this for menu.

How Can I do this..

Thanks in advance.

How To Get Menu Item Name
hi,

i would like to store the menu item name when ever we clicked on the menu item in any applications by sitting in one application...
i am trying using hooks .... but not getting ...

pl . give solution ...
will be apprecitable ...
URGENT
ADESH

Menu Item
Hello All:

I would appreciate any suggestions on how I may create my own context based menu item - for the system context menu. Have you noticed that when WinZip (for example) is installed, two new context menu items are added to the system's context menu? Well, I have created an application and would like to add an item so that when I right click a file in explorer or on the desktop the menu item appears in the pop up context menu so that I can select my program to perform a certain operation on the selected file.


sincerely
Hansel
hansel@solutions2000.net

Menu Item Dragging
One facility that Windows provides with certain menus is the ability to drag and drop items in them to different positions so that the user can re-order them (see for instance the Favorites menu in Internet Explorer and the Programs menu in the Start menu). So what if you want to have this sort of facility in your VB application? Can it be done?

The answer is yes, although clearly it can't be done with native VB, and it does in fact require subclassing of two separate windows. The attached project provides a demonstration of how it can be done. It emulates the design used in Windows 98, which is to have a bar appear over the menu to show where the menu item being dragged will be dropped. I have not explored emulating the design used in Windows XP, which is to have a translucent copy of the menu item being dragged appear as a drag icon, but no doubt the technique to do this would be similar, if more advanced.

The stages to allowing menu item dragging and dropping are:

1. Subclass the form that contains the menus. You will need to be comfortable with the concept of subclassing in order to understand the project. If you're not, try this thread by John.

2. In the subclassing routine for the form (WindowProc of SubClassForm), set the menus to be ownerdrawn. Code for this is courtesy of Garrett Sever at EliteVB .

3. Obtain the hwnd of the menu window. This is NOT the same as the handle to the menu, which all APIs to do with menus seem to use. Instead it is the handle to a window that contains the menu. You could get this through looking for the WM_ENTERIDLE message in the form subclassing routine, which gives it to you, although I do it by waiting until the first item in the menu is drawn, and then finding it with FindWindow.

4. Subclass the menu window. This is the key to the whole thing. All of the following steps are carried out in the menu window subclassing routine (MWProc of SubClassMenuWindow). The form subclassing routine does not give you sufficient messages to provide for menu item dragging, so you have to do this.

5. When the left mouse button goes down on the menu (MWM_MOUSEDOWN, MWM_MOUSEDOWNWIN98 messages), record where it does.

6. If the mouse moves (MWM_MOUSEMOVE message) outside the drag rectangle without coming up, begin a drag operation. Get a device context for the menu window, and draw a bar onto that device context to show where the menu being dragged will be dropped if the user releases the left mouse button.

7. When the left mouse button comes up (MWM_MOUSEUP, MWM_MOUSEUPWIN98 messages), don't call the original window procedure. Instead, re-arrange the data which your menus represent, and cause the menu window to be refreshed by use of InvalidateRect. This allows the user to see the changes that he has made before the menu is dismissed.

And that's about it. It is complicated, and it is otherwise undocumented so far as I can see, but it does work. If you have any comments or find any bugs then please PM me.

Menu Item Events - Please Help!
Here is my code, could someone please tell me what I am doing wrong? I can't link any events with these menus! This is killing me!


Set NoticeManagerMenu = objOutlook.ActiveExplorer _
.CommandBars("Menu Bar")

With NoticeManagerMenu.Controls
Set ctlpopup = .Add(Type:=msoControlPopup, Temporary:=True)
With ctlpopup
.Caption = "&NoticeManager"
With .Controls.Add(Type:=msoControlButton, Temporary:=True)
.Caption = "&Settings"


end with
end with
end with


even when I add .OnAction, the buttons do nothing! I have looked at many books and sites and can't seem to do it!

Menu Item Events?
I have created an outlook add-in, and have had no problems with the click events of commandbar buttons, but I have also created a popup menu with three menu items and cannot seem to connect any code to the menu choices.

How are events set up for menu items?

I tried the .onaction property and got no response, and tried to declare them as commandbar buttons and set up click events also to no avail.

Add Menu Item In AutoCAD
This is basically the same question that MILL had, except I need it in AutoCAD. I tried to use the responses in the other thread but I couldn't translate them into what I need.

I need to add menus and submenus to the main menu bar in AutoCAD2002. Then I obviously need to attach these menu items to functions I am writing. I am doing okay coding the functions but I am currently running them from forms I created just so I could test the functions. I need to run them from menus within AutoCAD. Please help.

Thanks in advance.

Bear with me, I am the ultimate newbie. [img]images/icons/smile.gif[/img]

Checking A Menu Item
I have a menu item to display/not display the status bar. For that I need to check/uncheck the "Status Bar" menu option. But it does not work. This is my code:


Code:
Private Sub mnuStatus_Click()
If mnuStatus.Checked = True Then
mnuStatus.Checked = False
Else
mnuStatus.Checked = True
End If
End Sub
Why doesn't it work?

Underline On Menu Item
a very finikety question...

how do you get an underline to show on a menu item without having to press Alt first....

If I put &Tools as the caption name for a menu item the underline will not show until I press ALT first....

This is different from the interface for word and could lead the user to think on first examination that there are no keyboard shortcuts available...

Menu Item Parameter
Is there a way for a menu item to pass a parameter to the underlying macro?

Im using

Code:
With oMenu.Controls.Add(msoControlButton, 1)
.Caption = sCaption
.OnAction = sAction
.BeginGroup = bGroup
End With
to add a new new menu item, but I'd like to call the same macro many times but with a different parameter for a different effect.

Thanks.

Mouseover On A Menu Item
Hi
I'm trying to get my status bar to give a description of the current menu item when the user has the mouse over the item, or when it is highlighted by using the arrow keys etc.

How can i register the mouse over to have a description somewhere else on the form?

Cheers
bratch

Repeat Last Menu Item
I have a bunch of menus in 2 seperate forms. I want an event like a keypress to repeat the last menu item selected.

API Click Menu Item?
u know with VB in AOL how u can click the buttons, like to send an IM or Open Email, by getting the handle and using the SendMessage() API. can u do it like this with a menu? im tring to be able to open email with the Mail menu, i was able to click it and bring down the menu, but how do i have it click on one of the menu items? to bring up New/Old/Sent Mail. or would u jus use the arrow keys (Virtual Keys[VK]) to do this?

Menu Item Images
Hey, Does anyone have a way to add an icon to a menu without it being darkened like SetMenuItemBitmap does?
I Dont want the colours inverted when it is selected either.
any help is apreciated
-Newbie

Mouse Over Menu Item
Is there any way to detect the mouseover event on menus? The only event listed is the click event. Thanks for any help

How Can I Get Menu Item From Other Application?
Hi friends?
I want to read the menu object of one vb application from other vb application. Is there anyway to read them?

Regards

Nazmul

Flashing Menu Item
Is there a way to make a menu item flashing, to grab user attention ?

Focus On A Menu Item
Hi
I am having a small problem. I need to know when a grid on my form is losing focus, this is ok as i use the lost focus event, but when I click on a menu item the lost focus event is not firing. Is there anyway to fire this event when I clcik on the menu item. I cannot manual fire this event because the form the control is on is not always open.

Any help would be greatly apreciated.

Thanks

Paul

Selecting A Menu Item
I've been trying for a few days now to select a menu item using API. I just can't do it. I've tried to send the WM_COMMAND, WM_MENUSELECT, and various others but to no avail... can someone give me a good description of how to do this? I know my code works as far as finding the proper submenu handle and menu item ID, but from there I don't know how to send a message that will select that menu item like a mouse click would normally do. Thanks very much!

Getting Menu Item Information
Hi,

How can I get menu item information (string, grayed/enabled, etc.) out of a specific dynamic menu? Which functions do I need to use?

Get/set Menu Item Properties
I am trying to get/set menu item properties of other windows, such as checked/enabled/greyed/etc. but i am having trouble getting the items handle. The menu items being submenus of the windows menubar. and GetMenu seems to give me a handle but the menu handle it gives me has 0 item count. And i can't seem to get MenuItemFromPoint to work, i get a 'Bad DLL Calling Convention' error, here is the declare and the statement:

Declare Function MenuItemFromPoint Lib "user32" (ByVal hWnd As Long, ByVal hMenu As Long, ByRef ptScreen As POINTAPI) As Long

API Viewer shows a ByVal for the ptScreen, but i know that won't work, so i tryed byRef and i get the above error. Here is the calling line.

mPos = MenuItemFromPoint(hWnd, hMenu, Point)

hWnd is obtained via WindowFromPoint
hMenu is obtained via GetMenu
Point is POINTAPI

Menu Item Iteration.
Hey all,
I have a menu at the top of my form. One of the menu items are "Options". I have several sub-menus and menu items within that menu. I want to be able to iterate through all of the children of that menu item.
In other words...let's say my menu structure is as follows:
File
---Save
---Print
--- --
---Exit
Edit
---Cut
---Copy
---Paste
Options
---Item 1
---Item 2
---Submenu
------Item S1
------Item S2
------Item S3
---Item 3
Help
---Contents
---Index
--- --
--- About this program.

I want to be able to retrieve information about just item 1,2,s1,s2,s3,and 3. How would I do this? I'd prefer the simplest way possible - not involving the API if at all possible, but I don't mind if it it's necessary.

Highlight Menu Item
In a web browser app, apart from adding pages to their favorites explicitly, users can also import all the favorites from Internet Explorer. To differentiate the favorites explicitly added by the users using my browser from the IE favorites, I would like to highlight those favorites in the menu which have been explicitly added by users. For e.g. suppose there are already 5 favorites in IE - Google, Yahoo, Hotmail, VBForums & Rediff. The user imports all the 5 favorites in my browser. Using my browser, the user also adds, say, Microsoft & Netscape to his favorites.

When the user clicks the favorites menu, I want Microsoft & Netscape to be highlighted so that the user can easily distinguish which favorites have been imported from IE & which favorites he added using my browser (like how WinXP highlights a newly added program in the Start menu).

Is there any way to highlight the menu items?

Menu Item 'Find'
How do I make my own 'Find' menu option?

Would I make my own small form with a couple of text box's, add three buttons for 'Find' & 'Find Next', and 'Replace'. (And a Cancel button)

Then loop through either the whole of the RichText Box, or just the selected text?

OR is there a built in method I could call?

Clicking A Menu Item
Hi, I'm trying to get into the Option menu of Firefox, but the code below doesn't work. The MsgBox doesn't return '0', so it finds the browser window, but it never clicks any menu items.

When I change "MozillaUIWindowClass" to "SciCalc" and the GetSubMenu/GetSubMenuID to 2/0 (Calculator), then it works fine.

Does anybody know what is wrong?


VB Code:
Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _    ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" ( _    ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _    ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function GetMenu Lib "user32" ( _    ByVal hwnd As Long) As Long Private Declare Function GetSubMenu Lib "user32" ( _    ByVal hMenu As Long, ByVal nPos As Long) As Long    Private Declare Function GetMenuItemID Lib "user32" ( _    ByVal hMenu As Long, ByVal nPos As Long) As Long    Private Const WM_COMMAND = &H111 Private Sub Command1_Click()    Dim lhWnd As Long, lMenu As Long, lID As Long, sBuffer As String        lhWnd = 0    Do        lhWnd = FindWindowEx(0&, lhWnd, "MozillaUIWindowClass", vbNullString)        If lhWnd Then            sBuffer = String(255, vbNullChar)            GetWindowText lhWnd, sBuffer, Len(sBuffer) + 1            If InStr(sBuffer, "Firefox") Then Exit Do        End If    Loop While lhWnd    If lhWnd = 0 Then Exit Sub        MsgBox lhWnd        lMenu = GetMenu(lhWnd)        lMenu = GetSubMenu(lMenu, 5)        lID = GetMenuItemID(lMenu, 6)        SendMessage lhWnd, WM_COMMAND, lID, 0&End Sub

Disappeared Menu Item
dear all,

my RAD crashed and i now do not have the project / references link! i still have the Components Ctrl-T one but not the one to the references...

does someone know how to reset it or a shortcut for it?

tx...

Add Item To IE Menu (Popmenu)
How can I add an Item to IE's right click menu...

Essentially heres what I want to do...

Wife finds a recipie on a certain site...
right click...."Add to Recipies"

then in the code...I want to strip out the good stuff and Insert it into a database.

Anyone?

Much Thanks!

Add An Image Beside A Menu Item
I want to be able to add an image beside an item in a menubar if possible.
An example of this would be, Open up Notepad and go view > statusbar and then click on view again after you've clicked Statusbar and youll notice that it has a checkmark beside it. How would I go about doing this?

Thanks.

Copyright © 2005-08 www.BigResource.com, All rights reserved