Invalid procedure call or argument RRS feed

  • Question

  • Hello ,

    We are using below code to create menu in excel and it is working fine in Excel 2016 for windows. However, below code is not working in Excel 2016 for Macintosh. The error "Run-time error '5' , invalid procedure call or argument" pops up. Can you please kindly check ? Is it because of Excel 2016 for Macintosh not allow to create dynamic menu in Excel 2016 ? What's the alternative solution if we need it to work in both Excel 2016 for windows & macintosh ?

      Set cbWSMenuBar = Application.CommandBars("Worksheet Menu Bar")
            Set cbc = cbWSMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
            cbc.Tag = APPNAME
            With cbc
                .Caption = APPNAME
                With .Controls.Add(Type:=msoControlButton, Temporary:=True)
                    .Caption = "Load PY Data"
                    .OnAction = "DataDownload.DownloadDB"
                    .Tag = "Item1"
                End With
                With .Controls.Add(Type:=msoControlButton, Temporary:=True)
                    .Caption = "Publish Data"
                    .OnAction = "DataUpload.UploadDB"
                    .Tag = "Item1"
                End With
            End With

    Friday, December 2, 2016 4:26 AM

All replies

  • Hi,

    Thanks for posting here.

    For issue about Office for Mac, I suggest you ask in https://answers.microsoft.com/en-us/msoffice.

    This forum is for Windows OS, we don’t have MacOS to reproduce and test your issue. The supporters on Microsoft Community might offer better suggestions for you.

    Sorry for any inconvenience and have a nice day! 



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 9, 2016 8:27 AM