none
Erorr when using VBA to control WordEditor? RRS feed

  • Question

  • I've got an Outlook VBA program that's worked under Outlook 2007 and Outlook 2011, but doesn't seem to be working under Outlook 2013. The code fragment where there's an issue is the second line

        Set oWordDoc = ActiveInspector.WordEditor
        oWordDoc.Application.Selection.EndOf Unit:=wdStory, Extend:=wdExtend

    Run-time error '4120'

    Bad parameter.

    Can anyone shed some light on this issue?

    Tuesday, October 7, 2014 12:01 AM

All replies

  • char = Selection.EndOf(Unit:=wdWord, Extend:=wdMove)

    It looks like the name of the function is declared with the parameter. Try to separate them explicitly.

    Also I'd suggest breaking the chain of calls and declaring each property and method on a separate line of code. Thus, you will be able to find the exact property or method call which fires the exception.


    Tuesday, October 7, 2014 5:03 AM