Word 2007: Run-time error 4120 Bad Parameter

J

jalanford

I have a macro that temporarily sets user options in the editing options of
the Word Options dialog. For the purposes of other macros being run:

Options.ReplaceSelection = True

This works fine in WD2003. In fact, if you record the action of setting this
option manually in the dialog box, you get the above line. However, when I
try to run this as part of a macro or by itself, I get a Run-time error 4120
Bad Parameter error. Something is obviously not right here. I tried changing
the macro security settings but nothing good came of it. I'm running Office
Pro 2007 on XP and I wonder if that's the problem. There was a similar issue
discussed here awhile back and it seems to me that there were varying results
depending on whether the user was running XP or Vista.

Anybody out there know anything about this "feature" and whether it's being
addressed OR whether there is some security setting somewhere that I am
overlooking?

Thanks for your time,

Jalanford
 
P

Perry

No problems here.
Toggling this Word setting in VBA at my system works fine.

Perhaps you can elaborate on what the (surrounding) conditions are when y're
trying to
toggle this setting?

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
 
J

jalanford

Hello,

In terms of VBA, if I try to run this line by itself with nothing else going
on, it still kicks the error. The initial setting of Options.ReplaceSelection
doesn't matter. When I include the line as part of a larger macro that sets
other editing options, it produces the error (several other lines in that
particular macro also produce this same error--selective and progressive
commenting out of lines lead to this discovery) The other problematic lines
are:

With Options
..AllowDragAndDrop = True
..AutoWordSelection = False
..PictureEditor = "Microsoft Office Word"
..Overtype = False
..CtrlClickHyperlinkToOpen = True
..AutorKeyboardSwitching = False
..PictureWrapType = wdWrapMergeInline
..DisplayPasteOptions = True
..PromptUpdateStyle = False
..FormatScanning = False
..ShowFormatError = False
..SmartParaSelection = False
..SmartCursoring = False
End With

The following lines work and do not produce an error:

With Options
..INSKeyForPaste = False
..PasteSmartCutPaste = False
..AllowAccentedUppercase = False
..TabIndentKey = False
End With

This macro is being run on a Windows machine with a Pentium 4 2.53 GHz CPU
and 1GB of RAM running Windows XP Professional Version 2002 Service Pack 2.

Thanks,

jalanford
 
P

Perry

Looks like a policy issue here:

These settings are stored in the Registry.
Do you have access to the registry?

Start | Run
and try invoke regedit.exe

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top