Share via

Application.CommandBars.ExecuteMso equivalent on a MAC

Anonymous
2016-03-14T19:49:26+00:00

Hello Everyone,

Please forgive me if this is not the appropriate forum for this question and please point to the right one, but does anyone know what the MAC equivalents are for the following VBA code?

Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")

and

Application.CommandBars.ExecuteMso ("ViewCustomViews")

Greatly appreciate your help.

Regards,

John

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-03-15T21:42:37+00:00

This is the right forum. However you need to be a bit more specific as to exactly what you are trying to do, and with what version of Excel. For example, in Excel 2016 for the Mac it is not possible to modify command bars or call command bar commands.

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-03-18T04:56:22+00:00

    You wrote: "Recording a macro yields no code. ... There is nothing in the MAC version that is comparable to Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint")."

    I had written: "In Mac Excel 2011 a recorded macro for selecting File > Print yields

    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1"

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-03-17T16:40:38+00:00

    Hi Bob,

    Thanks for the quick reply.  All I'm trying to do is to bring up the Custom Views box or the Print window with macros assigned to macro buttons on the Mac version of Excel.  I figured out how to do it on the Windows version of Excel, however, not being familiar with the MAC environment I'm not sure if it can be done.  Recording a macro yields no code.  Your answer actually answers my question.  There is nothing in the MAC version that is comparable to Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint").  Again, thank you.

    John

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-03-15T22:00:53+00:00

    In Windows Excel 2010 your first line of code performs the equivalent of choosing File > Print.

    In Mac Excel 2011 a recorded macro for selecting File > Print yields

    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1

    In Windows Excel 2010 your second line of code shows the Custom Views dialog box.

    In Mac Excel 2011 a recorded macro for selecting View > Custom Views by itself does not yield any code.

    In Mac Excel 2011 a recorded macro for selecting View > Custom Views > Add ... yields

    ActiveWorkbook.CustomViews.Add ViewName:="JohnSur", PrintSettings:=True, RowColSettings:=True

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2016-03-15T19:32:22+00:00

    You may also post your query in link and check if you are able to find some information.

    https://social.technet.microsoft.com/Forums/en-US/home?forum=Office2016forMac&filter=alltypes&sort=lastpostdesc

    Was this answer helpful?

    0 comments No comments