PDA

View Full Version : VBA Code problem for Excel 2016 on a mac



Malingrey69
01-25-2018, 05:34 PM
Hello all

I’m not a very good user of Excel on Mac and i’m an occasional teacher (in France). For many long time, I use a macro called « Stataix » withe help me to draw dot plot graphic. I know it’s inside Excel’16 now but I can do some thing with this macro I can’t do usually with the new version of Excel. This major allways work with PC (my PC’s owner student are happy) but doesn’t work with a mac. Can you take 5 minutes to tell me if there’s a solution…Or if I need to find myself a way to correct it ?


Many thanks for your possible answer.


Best regard


José

Option Explicit
Public Const APPNAME = "StatAix"
Public Const APPVERSION = "1.2"
Public Const StatAixCaption As String = APPNAME
Public Const DBoitamouCaption As String = "Donnees Boîte à moustaches"
Public Const DBoitamouMacro As String = "DonneesBoiteAMoustaches"
Public Const GBoitamouCaption As String = "Graph Boîte à moustaches"
Public Const GBoitamouMacro As String = "GraphBoiteAMoustaches"
Public Const DesinstallerCaption As String = "Desinstaller"
Public Const DesinstallerMacro As String = "Desinstaller"

Sub CreateMenu()
Dim XLCommandBar As Integer
Dim NewMenu As CommandBarPopup
Dim NewItem As CommandBarButton
Dim ToolsMenu As CommandBarPop
XLCommandBar = 1 'Worksheet Menu Bar
' This code handles non-English versions of Excel
' in which the 'Tools' menu has a different name
Set ToolsMenu = CommandBars(XLCommandBar).FindControl(msoControlPopup, 30007)
' Delete the current menu if it exists (just in case)
On Error Resume Next
CommandBars(XLCommandBar).Controls(StatAixCaption).Delete
On Error GoTo 0
' Create the new menu item
Set NewMenu = CommandBars(XLCommandBar).Controls.Add(Type:=msoControlPopup) >>> This instruction doesn’t work on Mac. But works on a PC...
NewMenu.Caption = StatAixCaption

paulked
01-25-2018, 07:43 PM
X-posted here: https://www.mrexcel.com/forum/excel-questions/1040647-problem-macro-excel-2016-mac-french-teacher.html

Cross posting is against the rules without posting a link to the cross-post, please read them.

Aflatoon
01-26-2018, 02:25 AM
You can't customise the menu bar in Excel 2016 on a Mac. I'd suggest you look into ribbon customisation instead.

Malingrey69
01-26-2018, 06:37 AM
You can't customise the menu bar in Excel 2016 on a Mac. I'd suggest you look into ribbon customisation instead.

Thank you Aflatoon and sorry for the delay to answer : I live in France :)

I'm not good with VBA code. Is it easy to change it ? Or is it possible I put here "the whole code" and you can make the change for me ? I know "how to develop" the code but I don't know the word of code. But I'm condident in my capacities to copy / paste a right code.

To summurize, if I put here the whole code, do you have the time and/or the competencies to change it ?

Many thanks for your time and your answer, even if it's "no" :)

Best regard

José from France.

Aflatoon
01-26-2018, 07:49 AM
You can't do it in VBA. You need to modify the CustomUI part of the workbook's XML. See Ron de Bruin's site for more details and examples. (www.rondebruin.nl)

Malingrey69
01-26-2018, 01:45 PM
Thank you Aflatoon. Im' in contact with him and he tries to find a solution :)

Best regard

José