Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

Word 2007: Options.ReplaceSelection -> Run-time error 4120 Bad Parameter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hans - 19 Oct 2007 13:29 GMT
Hi,

In April, jalanford wrote a carefully composed message in
microsoft.public.word.vba.general on the subject of run-time errors when
trying to set a number of parameters like Options.[SomeParameter] via VBA.

The problem occured only on some machines with Word 2007 and Windows XP. We
can't reproduce it on our machines, and we have no direct access to machines
affected by the problem.

But we have the same problem with a small number of our customers and are
looking for the best way to make our add-in work on their systems - other
then writing a patch for our software, which we will do anyway. If the
registry is involved, even a patch will probably require some "manual"
action by the customer in certain cases. So far, we succest to run our Word
add-in on a newly created user account, which worked in all known cases, but
is far from ideal, of course.

Unfortunately, the discussion then in the newsgroup stopped before someone
provided a solution. The only suggestion was to repair the registry, but
there was no follow-up.

Could jalanford or someone else please give some advice how you worked
around the problem? If so, I would try to compile an answer to the problem
for the newsgroup.

Thanks in advance

Hans
JimmyHoffa - 24 Oct 2007 12:06 GMT
After encountering the same problem on a customers machine and much
head scratching, my solution was to make sure that in word options
that the Username and Initials are not blank, or a space...  it
appears if they are, you cannot set certain word options without
getting the runtime error 4120 bad parameter.. Another fine MS bug.

> Hi,
>
[quoted text clipped - 25 lines]
>
> Hans
Hans - 26 Oct 2007 14:42 GMT
Thanks a lot!

From your hint, I could finally and regularly reproduce the run-time error
4120 (or 24 with a password protected project) on my machine when using the
VBA command Options.ReplaceSelection = True or other variants of
Options.[something]. Simply by clicking the Office button, then
Word-Options, then changing the contents of the Username field to a blank
space.

It was not possible for me to get the Username field to be entirely empty,
not even by manually editing the registry keys
...\Software\Microsoft\Office\Common\UserInfo, where the information is
stored. When I tried to delete it's whole content, either in the registry or
in the Word options dialog, the registry value or options Username field was
always automatically reset to contain the name of the Windows XP user
account.

The Initials field alone did not do the trick, though I couldn't get that
entirely empty, too.

I'm not sure how the Username field can happen to contain a blank space (or
nothing at all) after installing Office 2007 in the first place. But we had
at least 6 customers in different parts of the country with this problem, so
the chances seem to be not totally negligible. In one case, half of the
machines in a school classroom were affected.

I'll do some additional tests and ask our customers to verify the solution,
then come back with a summary.

Hans

> After encountering the same problem on a customers machine and much
> head scratching, my solution was to make sure that in word options
[quoted text clipped - 38 lines]
>>
>> Hans
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.