Re: Runtime 91 error for ActiveDocument in AutoExec macro

Tech-Archive recommends: Fix windows errors by optimizing your registry



I don't have any experience with Citrix, but if the connection is as slow as
your message seems to suggest, that in itself could be the cause. It might
also explain why some people see the error and others don't -- those that do
might just have a slower connection for some reason.

It might be possible in your AutoExec macro to use an On Error trap in a
loop, so that the first access to ActiveDocument is retried until it
succeeds or there have been a specified number of unsuccessful tries (or
until a specified time has elapsed). Be sure to allow some exit condition of
this sort, so the loop doesn't lock up the application for an extended
period.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

proashu wrote:
Thanks Jay.

The additional delay of few seconds might not be desirable to our
business. This is happening over a Citrix connection, and additonal
delay is not good.

My recent findings indicate that -
When I try to look at the MS Word installs for the people who are
affected by the Runtime error,

I do not see any addins in the startup folder.
I do not see any COM Addins as well.

So I am not sure what else would cause the ActiveDocument not to
load before my AutoExec logic fires off, and throw a Runtime 91 error
when I invoke ActiveDocument.bookmarks

Is there anything else that you can think of that can cause the
loading of the document to be delayed ?




"Jay Freedman" wrote:

The AutoExec macro starts running as soon as Word loads, which may
be before there is any document loaded into the workspace. I'd guess
that the difference between the two situations -- working vs.
failing -- may depend on just how long it takes for the document to
load, which in turn may depend on whether an add-in like Acrobat
Writer is loading first, or on whether the document is stored
locally or across the network.

You might be able to work around this with the OnTime technique in
http://word.mvps.org/faqs/userforms/AutoExecUsertFm.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

proashu wrote:
I am trying to invoke MS word in the following manner:

start winword.exe /lc:\glb\myglobal.dot /tc:\tmp\doctemplate.dot /

myglobal.dot -
My global template - contains the following logic
Public Sub AutoExec()
If ActiveDocument.Bookmarks.Exists("CSWB") Then If (InStr(1,
ActiveDocument.FullName, ".rtf") < 1) Then
ActiveDocument.RunAutoMacro (wdAutoNew)
End if
End If

doctemplate.dot -
A document template that contains the AutoNew macro defined.

Problem scenario:
When I run - "start winword.exe /lc:\glb\myglobal.dot
/tc:\tmp\doctemplate.dot /" from command prompt it works fine.

I install Adobe Acrobat writer on my machine, and run the same
command,
It fails with a Runtime 91 error - Object variable not set
Looks like ActiveDocument object is not initialized and fails when I
try to access ActiveDocument.Bookmarks collection.

When I uninstall Adobe acrobat writer, the problem goes away.

This is happening in production as well (that actually triggered
this analysis) but I don't necessarily see Adobe writer installed in
production. Is there anything else that when installed would change
the behaviour of AutoExec as I have mentioned ?

If you have any ideas as to how can I avoid this, that would be
great.


.



Relevant Pages

  • Re: How to control LAN users?
    ... Shutting down the machines would work for me, there might be some unhappiness but I could deal with that, but what I'm really looking for is a way to open the connection to the internet at my discretion. ... If vncviewer is not in /usr/bin, ... The windows versions of vnc can be downloaded from: ... It installs and you put it in service mode. ...
    (Fedora)
  • Re: SP2 XP Home issues
    ... > For the first problem, try cleaning up your hard drive, delete tmp ... > For the second problem, SP2, installs a new MS firewall, and enables ... the TCP/IP filtering for the connection is left locked down, ... Advanced button, Options tab, TCP/IP filtering properties, all protocols ...
    (microsoft.public.windowsxp.perform_maintain)
  • IEEE 1394 card blocks Internet connection
    ... I connect to the Internet with a DSL modem/Ethernet and/or ... Connections there is a new 1394 Net Connection listed. ... I have tried disabling the 1394 controller in Device ... soon as the computer is restarted, Windows installs it ...
    (microsoft.public.windowsxp.network_web)
  • Re: Opening browser does not bring up my internet connection box automat. anymore
    ... Google Toolbar and on that same day it automatically downloaded a valentine ... mess up again since the toolbar installs that scheme for the new profile ... Installed the latest critical updates on the Windows ... > connection settings are set to Always dial. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Runtime error 3155 inserting to linked SQL tables from Access
    ... I does sound that when you execute the insert in the AutoExec, the database ... has not establish a connection to the SQL Server BE. ...
    (microsoft.public.sqlserver.odbc)