none
Can't Create Macros any more in Word for Mac RRS feed

  • Question

  • Hi,

    Today I had my Keychain file corrupted, or something like that, and the Apple Support tried multiple things, but eventually we drug the Apple Keychain's folder into the trash which fixed all the iCloud/email/iMessage problems. However, it created problems in Word for Mac. My custom macros went away. I tried making new ones, but every time got a Error Code 5941 run time error. I tried many things for the last 5 hours. I even uninstalled and reinstalled Office 365 to see if that might fix it. So far, I haven't found a fix. I am a writer (not a programmer). I usually create simple macros to modify font. Font color and size. I then assign the macros to custom keystrokes and have been doing this for years, have done it on many computers, and not until today have I been thwarted. Here is the steps I go through to make a simple macro to change the font color from black to blue. Sorry if this is beneath you. I will also paste in a screenshot of the code. 

    I click on the developer tab, select record macro, name macro "Bluefont" and select okay. 

    Go to the very top "format" pull down and select font, then select font color blue, then okay, then stop recording macro.

    This has always worked in the past. It is working on my MacBook and my wife's iMac right now as we speak. But for some reason I am getting the 5941 error. I thought reinstalling Word would fix it, but it has not. I don't know anything about programming, but I can read and copy and paste :^) I have copied and pasted what I see when I select "debug" after getting the error code. Thank you for any help you can give me. I want to make several other macros like this for different colors and also two for changing the font to 15pt, and changing the font to 12pt. 

    Sub Bluefont()
    '
    ' Bluefont Macro
    '
    '
        With ActiveDocument.Styles(-1031106208).Table.Condition(wdFirstRow).Font
            .Name = "Arial"
            .Size = 15
            .Bold = False
            .Italic = False
            .Underline = wdUnderlineNone
            .UnderlineColor = wdColorAutomatic
            .StrikeThrough = False
            .DoubleStrikeThrough = False
            .Outline = False
            .Emboss = False
            .Shadow = False
            .Hidden = False
            .SmallCaps = False
            .AllCaps = False
            .Color = 16724484
            .Engrave = False
            .Superscript = False
            .Subscript = False
            .Spacing = 0
            .Scaling = 100
            .Position = 0
            .Kerning = 0
            .Animation = wdAnimationNone
        End With




    Wednesday, January 10, 2018 10:57 PM

All replies

  • Hi Jack Dagger,

    let me first inform you that we are not available with MAC to test this code.

    if i run the code as it is on Windows then i can reproduce the same error on my side.

    i find that that the parameter value for styles is not correct in line below.

    i try to replace that value with the value in line below.

    With ActiveDocument.Styles("Table Normal").Table.Condition(wdFirstRow).Font

    now , code is running without any error.

    thing is that you need to pass valid parameter value for styles.

    you can modify it as per your requirement.

    you can also refer link below may give you some additional information.

    Styles Collection Object

    Style Object (Word)

    Regards

    Deepak


    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.

    Thursday, January 11, 2018 9:25 AM
    Moderator
  • Hi Jack Dagger,

    Is your issue solved?

    I find that you did not follow up this thread after posting the issue.

    If your issue is solved then I suggest you to post your solution and mark it as an answer.

    If your issue is still exist then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Deepak


    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, January 26, 2018 8:58 AM
    Moderator