Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open "Function Argument Window" using a macro

On 26 juil, 13:51, "Niek Otten" wrote:
Look he

http://www.jkp-ads.com/Articles/RegisterUDF00.htm

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


What I could find on that website was how to give a description/
tooltip to my custom function. This is not what I was meaning so I'll
show my problem with a code sample.

I add a few menus with this when I add my xla file to Excel :

Sub AddMenus()
Dim cMenu1 As CommandBarControl
Dim cbMainMenuBar As CommandBar
Dim iHelpMenu As Integer
Dim cbcCutomMenu As CommandBarControl

On Error Resume Next
Application.CommandBars(1).Controls("&MCPH").Delet e
Set cbMainMenuBar = Application.CommandBars(1)
iHelpMenu = cbMainMenuBar.Controls("?").Index
Set cbcCutomMenu =
cbMainMenuBar.Controls.Add(Type:=msoControlPopup, Befo=iHelpMenu)
cbcCutomMenu.Caption = "&MCPH"

'Add Item
With cbcCutomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "EVLSJ_ELEV"
.OnAction = "mcph.xla!OpenFunctionArgumentWindow"
End With

'Add Item
With cbcCutomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "EVLSJ_ELEV2"
.OnAction = "mcph.xla!
OpenFunctionArgumentWindow2(""EVLSJ_ELEV"")"
End With

On Error GoTo 0
End Sub

Public Sub OpenFunctionArgumentWindow()
MsgBox "In OFAW"
ActiveCell.Formula = "=EVLSJ_ELEV()"
Application.Dialogs(xlDialogFunctionWizard).Show
End Sub

Public Sub OpenFunctionArgumentWindow2(mFunction As String)
MsgBox "In OFAW2"
ActiveCell.Formula = "=" & mFunction & "()"
Application.Dialogs(xlDialogFunctionWizard).Show
End Sub

As you can see in the code, I put a onAction of
OpenFunctionArgumentWindow and one on OpenFunctioNArgumentWindow2.
When I click on the menu item that does not pass any argument, the
formula =EVLSJ_ELEV() is put in the cell and the Function Argument
Window is opened. However, with OpenFunctionArgument2 the formula is
set correctly but the function argument window does not open. Also,
we can see the msgbox twice!

Anyone has a solution?

Thanks a lot!

François Tremblay

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
"page number" function as an argument squeaky Excel Discussion (Misc queries) 0 August 8th 08 08:03 PM
Pivot Table Creation Macro fails with Error #5 "Invalid procedure call or argument" [email protected] Excel Programming 1 July 10th 07 08:01 PM
How to change the font of Display window of "Open File" Windows Font Excel Discussion (Misc queries) 0 January 6th 06 03:10 AM
Use Macro to open "Find" window supafreeza Excel Programming 1 July 14th 05 02:19 AM
Using a "File-Open"-Window in a Excel Macro? PeterBrinkrolf Excel Programming 8 April 22nd 04 07:50 PM


All times are GMT +1. The time now is 10:37 AM.

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"