473,761 Members | 5,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange Automation Issue

I have a strange situation with my Access 2000 database. I have code in the
database which has worked fine for years, and now all of a sudden doesn't
work fine on one or two of my client's machines. The code opens MS Word
through Automation and then opens a particular Word doc. It's still working
fine on most machines; but on one or two of them, the user is getting an
Automation Error. The code used is as follows:

Dim objWord As Word.Applicatio n
Set objWord = New Word.Applicatio n
objWord.Documen ts.Open FileName:=strFi lename, _
ConfirmConversi ons:=False, _
ReadOnly:=False , _
AddToRecentFile s:=False, _
Revert:=False, _
Format:=gcon_wd OpenFormatAuto 'this is global constant with
Word constant value

The Automation Error occurs on the third line, when trying to open the
document (the document does exist, so that's not the problem).

Even stranger than the fact that the problem's only happening on two out of
several dozen machines, is the following. I have a pared-down copy of the
database, that users use to take on the road with them and show to clients.
The pared-down version (call it "App B") was taken from the original (call
it "App A") with some functionality removed. Regarding the above code that's
failing, both App A and App B are identical, and both have the same
references.

Now, here's the really strange part.

On one computer that's having problems, App A fails in the above code. On
the other computer that's having problems, App A works fine in the above
code, but App B fails in that code. So, in the second case, with the same
computer and two identical sets of code, one set fails, the other doesn't.

I've looked at backup copies to see if it was a corruption issue, and
haven't seen any difference. And, as noted, this code has been in place for
years without problems, until just the other day when these problems started
happening.

All of the users have MS Office and the database application installed on
their C drives.

Any assistance would be appreciated.

Thanks!

Neil
Nov 12 '05
25 3736
Thanks for the note. I've had better success with opening new instances in
the past in other situations. Found some bizarre behavior when using
existing instances of Word. Either way, it happens with a clean boot.

Will let you know what happens.

Thanks,

Neil

"Geoff" <ge***@nospam.f or.me.com> wrote in message
news:bn******** **@newsg2.svr.p ol.co.uk...
Neil

Now that this thread has arrived on my machine and
notwithstanding Tom's lead in the other thread (which
perhaps offers more hope).

Word is (I believe) an application that likes to have only
one instance running - although I think I've got multiple
instances running from code before now for reasons
I've never got to the bottom of. Also, I've read some
incomprehensibl e stuff on memory not being released
when some object variables are set to Nothing after
they've been created using 'New' (even when no other
variables are pointing to the same object).

So, as you're using CreateObject, is there any mileage
in using the GetObject function first (to utilise any
running instance of Word, if Word prefers to be in
memory only once or simply to save system resources).
And, if GetObject produces error 429, then using
CreateObject?

I've seen two coding variations for the above, each of
which uses a boolean variable to leave Word running
if GetObject was successful, but quit Word if
CreateObject was successful. (I can post samples if
you want them.)

No doubt you're destroying object variables when
no longer needed by setting them to Nothing.

Presumably all Office/Windows service packs are
installed on the offending machine.

I realise this doesn't address your specific issue or
the bizarre nature of your code suddenly not
working - but HTH.

Like Tom, I'd be interested in your solution.

Regards
Geoff

Nov 12 '05 #11
TC

"Geoff" <ge***@nospam.f or.me.com> wrote in message
news:bn******** **@newsg2.svr.p ol.co.uk...

(snip)
Word is (I believe) an application that likes to have only
one instance running


Geoff, that's not really so. There is no problem having multiple instances
of Word running. In some cases, you might *prefer* to have a seperate
instance, to avoid disturbing whatever the user is doing "manually" with an
"existing" copy of Word.

HTH,
TC

Nov 12 '05 #12
TC

"rkc" <rk*@yabba.dabb a.do.rochester. rr.bomb> wrote in message
news:cv******** ***********@twi ster.nyroc.rr.c om...

"TC" <a@b.c.d> wrote in message news:1067486213 .516312@teuthos ...
I found a couple of posts about this error: both in German! Here's one,
translated by altavista:


<snip translation>
Ok, that was fun! Now let's try something else.


Cracked me up.

I particularly liked "NT 4.0 with service luggage 6a" !!

TC
Nov 12 '05 #13
I guess I could have found the link to the KB article a lot easier, which I gave at the
end of my earlier reply, if I had only known how to search correctly! Go to the Microsoft
KB, and simply enter -2147023067 as the search term. You need to select either
Office 2003 or "All Microsoft Products" in the "Select a Microsoft Product" dropdown.

Note: You won't find anything if you select any of the following products:

Access 2000
Office 2000
Access 2002
Office XP
Access 2003

That's pretty amazing, considering that at the bottom of the article, one finds the
following:
The information in this article applies to:
a.. Microsoft Visual Basic Enterprise Edition for Windows 5.0
b.. Microsoft Visual Basic Enterprise Edition for Windows 6.0
c.. Microsoft Visual C++, 32-bit Professional Edition 5.0
d.. Microsoft Visual C++, 32-bit Professional Edition 6.0
e.. Microsoft Office 2003, All Editions
f.. Microsoft Office XP Developer
and I would have thought that Access 2002 is a part of Office XP, and that Access 2003 is
a part of Office 2003.

_______________ _______________ _______________ ________

"Tom Wickerath" <AO************ ***********@com cast.net> wrote in message
news:Ar******** ************@co mcast.com...

Here is a KB article that might be helpful:

INFO: Translating Large Office Automation Error Values
http://support.microsoft.com/default...roduct=acc2000

It includes a link to this KB article:
INFO: Translating Automation Errors for VB/VBA (Long)
http://support.microsoft.com/default.aspx?kbid=186063
When I ran the MessageText function with the error number you reported, I get the
following result. Note: I had to change the scope of the function from Private to Public.

?MessageText(-2147023067)
Incompatible version of the RPC stub.

Hmmm....what does this helpful message mean? I conducted a search of the Knowledge Base
at:
http://support.microsoft.com/default...;EN-US;KBHOWTO

using the text returned by the MessageText function. I specified "All Microsoft Products"
and "Using: All of the words entered". I found 7 hits, one of which looks particularly
promising:

PRB: Office Automation Fails with an Incompatible RPC Stub Error
http://support.microsoft.com/default...b;en-us;320108

I think you may find the answer in the above KB article!

Good Luck, and please report your findings back to the newsgroup.

Tom
_______________ _______________ _____________

"Neil Ginsberg" <nr*@nrgconsult .com> wrote in message
news:PU******** *********@newsr ead4.news.pas.e arthlink.net...

In my case, Err.Number = -2147023067 and vbObjectError = -2147221504.
Subtracting the second from the first I get 198437, which according to your
notes means it's a VBA error. I'm not sure where that gets me, since the VBA
code hasn't changed years and it started being problematic a couple of days
ago. Any ideas?

Thanks,

Neil
"Geoff" <ge***@nospam.f or.me.com> wrote in message
news:bn******** **@newsg1.svr.p ol.co.uk...
the user is getting an Automation Error.


Neil

I don't know if this might help pinpoint the problem.

Have you written an error handler to display the
automation error using the vbObjectError constant?

If you need it, the following information relates to the
vbObjectError constant:

1. Subtracting vbObjectError from Err.Number will
indicate the error as defined by the server application.

2. However, if subtracting vbObjectError from Err.Number
results in a number outside the range 0 - 65535, the
error is a VBA error.

Therefore, your error handler might look like:

' Remove the constant added by the server application:
MyError = Err.Number - vbObjectError

' Is the result in the range 0 - 65535?
If MyError > 0 and MyError < 65535 then

Msg = "The object you accessed assigned this number to " & _
"the error: " & MyError & ". The originator of " & _
"the error was: " & Err.Source & ". Press F1 to " & _
"see the originating applications' help topic."

Else ' It's a VBA error:

Msg = "This error " & Err.Number & " is a VBA error. " & _
"Press Help button or F1 for VBA Help topic on " & _
"this error."

End if

Msgbox Msg, , "Object Error", Err.Helpfile, Err.HelpContext
Obviously, this doesn't solve your problem, but it may
help you identify it.

HTH
Geoff



Nov 12 '05 #14
> and I would have thought that Access 2002 is a part of Office XP, and that
Access 2003 is
a part of Office 2003.


Remember: indexers are just poor slobs who have stared at too many
characters over too many cups of coffee for too many hours.

Neil
Nov 12 '05 #15
Here's an update on the situation.

You'll recall that there are two machines with problems, and two apps --
"App A" (the original) and "App B" (the pared-down version). One machine had
problems with automation with App A; the other machine worked with App A but
had automation issues with App B. No other machines had problems. At least
part of the puzzle has been resolved.

The user who was having trouble with App A had created a shortcut to Word on
her own, and, it turns out, she found an old copy of Word 97 on the server
and opened that instead of Word 2000. After that, the automation code in
Access didn't work (the reference was to Word 2000) -- though, for some
reason, it was able to open Word and create the reference, but wasn't able
to do anything with it. Once she stopped using that shortcut and began using
Word 2000 again, the problem went away.

So that takes care of that.

Regarding the second issue, as noted in my response to TC, it turns out that
I *did* have different code between App A and App B -- App A had been
changed a few months back, though I forgot about it. App A was using early
binding, and App B was using late binding. And, despite the literature,
early binding was working, but late binding wasn't. So I changed App B to
early binding to match App A, but it's still not working.

And that's where I'm at now.

Neil
All the news that's fit to print.
"Geoff" <ge***@nospam.f or.me.com> wrote in message
news:bn******** **@newsg2.svr.p ol.co.uk...
Neil

Now that this thread has arrived on my machine and
notwithstanding Tom's lead in the other thread (which
perhaps offers more hope).

Word is (I believe) an application that likes to have only
one instance running - although I think I've got multiple
instances running from code before now for reasons
I've never got to the bottom of. Also, I've read some
incomprehensibl e stuff on memory not being released
when some object variables are set to Nothing after
they've been created using 'New' (even when no other
variables are pointing to the same object).

So, as you're using CreateObject, is there any mileage
in using the GetObject function first (to utilise any
running instance of Word, if Word prefers to be in
memory only once or simply to save system resources).
And, if GetObject produces error 429, then using
CreateObject?

I've seen two coding variations for the above, each of
which uses a boolean variable to leave Word running
if GetObject was successful, but quit Word if
CreateObject was successful. (I can post samples if
you want them.)

No doubt you're destroying object variables when
no longer needed by setting them to Nothing.

Presumably all Office/Windows service packs are
installed on the offending machine.

I realise this doesn't address your specific issue or
the bizarre nature of your code suddenly not
working - but HTH.

Like Tom, I'd be interested in your solution.

Regards
Geoff

Nov 12 '05 #16
Here's a new twist. I just went into App B with the new early binding code
on the machine that's having problems (no other machine has problems), and
ran the code to open a Word doc. Interesting results. I get a message that
the specific document is locked by another user (the current user of that
machine) and I'm given the option of opening it Read Only, etc. I select
Read Only and the document opens in Word. I then go back to my app, and
there's the same Automation Error as before -- only, instead of it being on
the line that opens the Word doc, it's on the line:

objWord.visible = True

The Word instance was already visible, since I saw the document open. But
that line of code hadn't been executed.

Again, this is the same code that's running fine on other machines.
Interesting.

Neil

"Neil Ginsberg" <nr*@nrgconsult .com> wrote in message
news:hT******** **********@news read4.news.pas. earthlink.net.. .
Here's an update on the situation.

You'll recall that there are two machines with problems, and two apps --
"App A" (the original) and "App B" (the pared-down version). One machine had problems with automation with App A; the other machine worked with App A but had automation issues with App B. No other machines had problems. At least
part of the puzzle has been resolved.

The user who was having trouble with App A had created a shortcut to Word on her own, and, it turns out, she found an old copy of Word 97 on the server
and opened that instead of Word 2000. After that, the automation code in
Access didn't work (the reference was to Word 2000) -- though, for some
reason, it was able to open Word and create the reference, but wasn't able
to do anything with it. Once she stopped using that shortcut and began using Word 2000 again, the problem went away.

So that takes care of that.

Regarding the second issue, as noted in my response to TC, it turns out that I *did* have different code between App A and App B -- App A had been
changed a few months back, though I forgot about it. App A was using early
binding, and App B was using late binding. And, despite the literature,
early binding was working, but late binding wasn't. So I changed App B to
early binding to match App A, but it's still not working.

And that's where I'm at now.

Neil
All the news that's fit to print.
"Geoff" <ge***@nospam.f or.me.com> wrote in message
news:bn******** **@newsg2.svr.p ol.co.uk...
Neil

Now that this thread has arrived on my machine and
notwithstanding Tom's lead in the other thread (which
perhaps offers more hope).

Word is (I believe) an application that likes to have only
one instance running - although I think I've got multiple
instances running from code before now for reasons
I've never got to the bottom of. Also, I've read some
incomprehensibl e stuff on memory not being released
when some object variables are set to Nothing after
they've been created using 'New' (even when no other
variables are pointing to the same object).

So, as you're using CreateObject, is there any mileage
in using the GetObject function first (to utilise any
running instance of Word, if Word prefers to be in
memory only once or simply to save system resources).
And, if GetObject produces error 429, then using
CreateObject?

I've seen two coding variations for the above, each of
which uses a boolean variable to leave Word running
if GetObject was successful, but quit Word if
CreateObject was successful. (I can post samples if
you want them.)

No doubt you're destroying object variables when
no longer needed by setting them to Nothing.

Presumably all Office/Windows service packs are
installed on the offending machine.

I realise this doesn't address your specific issue or
the bizarre nature of your code suddenly not
working - but HTH.

Like Tom, I'd be interested in your solution.

Regards
Geoff


Nov 12 '05 #17
Did you work as an "indexer" as your first job? <smile>

Also, have you been able to rule out the possibility of incorrect OLE Automation
system files? I was thinking that perhaps this particular PC does not have the
Windows XP operating system, but it had some other software installed, which may
have installed an incorrect version of the OLE Automation files intended for
Windows XP. That scenerio may have led to the automation error you reported for
your application....

_______________ _______________ _______

"Neil Ginsberg" <nr*@nrgconsult .com> wrote in message
news:D3******** *********@newsr ead3.news.pas.e arthlink.net...
and I would have thought that Access 2002 is a part of Office XP, and that
Access 2003 is a part of Office 2003.


Remember: indexers are just poor slobs who have stared at too many
characters over too many cups of coffee for too many hours.

Neil

Nov 12 '05 #18
TC
Keep us posted!

TC
"Neil Ginsberg" <nr*@nrgconsult .com> wrote in message
news:s0******** **********@news read4.news.pas. earthlink.net.. .
Here's a new twist. I just went into App B with the new early binding code
on the machine that's having problems (no other machine has problems), and
ran the code to open a Word doc. Interesting results. I get a message that
the specific document is locked by another user (the current user of that
machine) and I'm given the option of opening it Read Only, etc. I select
Read Only and the document opens in Word. I then go back to my app, and
there's the same Automation Error as before -- only, instead of it being on the line that opens the Word doc, it's on the line:

objWord.visible = True

The Word instance was already visible, since I saw the document open. But
that line of code hadn't been executed.

Again, this is the same code that's running fine on other machines.
Interesting.

Neil

"Neil Ginsberg" <nr*@nrgconsult .com> wrote in message
news:hT******** **********@news read4.news.pas. earthlink.net.. .
Here's an update on the situation.

You'll recall that there are two machines with problems, and two apps --
"App A" (the original) and "App B" (the pared-down version). One machine had
problems with automation with App A; the other machine worked with App A

but
had automation issues with App B. No other machines had problems. At least part of the puzzle has been resolved.

The user who was having trouble with App A had created a shortcut to Word on
her own, and, it turns out, she found an old copy of Word 97 on the

server and opened that instead of Word 2000. After that, the automation code in
Access didn't work (the reference was to Word 2000) -- though, for some
reason, it was able to open Word and create the reference, but wasn't able to do anything with it. Once she stopped using that shortcut and began

using
Word 2000 again, the problem went away.

So that takes care of that.

Regarding the second issue, as noted in my response to TC, it turns out

that
I *did* have different code between App A and App B -- App A had been
changed a few months back, though I forgot about it. App A was using early binding, and App B was using late binding. And, despite the literature,
early binding was working, but late binding wasn't. So I changed App B to early binding to match App A, but it's still not working.

And that's where I'm at now.

Neil
All the news that's fit to print.
"Geoff" <ge***@nospam.f or.me.com> wrote in message
news:bn******** **@newsg2.svr.p ol.co.uk...
Neil

Now that this thread has arrived on my machine and
notwithstanding Tom's lead in the other thread (which
perhaps offers more hope).

Word is (I believe) an application that likes to have only
one instance running - although I think I've got multiple
instances running from code before now for reasons
I've never got to the bottom of. Also, I've read some
incomprehensibl e stuff on memory not being released
when some object variables are set to Nothing after
they've been created using 'New' (even when no other
variables are pointing to the same object).

So, as you're using CreateObject, is there any mileage
in using the GetObject function first (to utilise any
running instance of Word, if Word prefers to be in
memory only once or simply to save system resources).
And, if GetObject produces error 429, then using
CreateObject?

I've seen two coding variations for the above, each of
which uses a boolean variable to leave Word running
if GetObject was successful, but quit Word if
CreateObject was successful. (I can post samples if
you want them.)

No doubt you're destroying object variables when
no longer needed by setting them to Nothing.

Presumably all Office/Windows service packs are
installed on the offending machine.

I realise this doesn't address your specific issue or
the bizarre nature of your code suddenly not
working - but HTH.

Like Tom, I'd be interested in your solution.

Regards
Geoff



Nov 12 '05 #19
Thanks for the kick up the proverbial...

You've forced me to re-read about single-use and
multiple-use application classes.

I see that Word's application class is single-use (by
default) or multiple-use. This was the missing piece
of the jigsaw in my understanding of using 'New',
'CreateObject' and 'GetObject'.

This seems amazing now as I've been using these
commands successfully for some time.

Thanks again.
Geoff



Nov 12 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2529
by: a_bogdan_marinescu | last post by:
Hello all, I'm trying to do some COM automation from Python (using Mark Hammond's Win32 extensions, of course) and I'm getting some very strange errors. Specifically, I try to use a COM object that supports events, and I'm instantiating it like this: eventobj = win32com.client.DispatchWithEvents( crtthread, DebuggerThreadEvents )
15
5846
by: qwweeeit | last post by:
Hi all, Elliot Temple on the 1 June wrote: > How do I make Python press a button on a webpage? I looked at > urllib, but I only see how to open a URL with that. I searched > google but no luck. > For example, google has a button <input type=submit value="Google > Search" name=btnG> how would i make a script to press that button? I have a similar target: web automation, which
0
1264
by: Matt | last post by:
Hello, I am having an issue when I try to automate Access. When working in the automated application, it seems that all warning messages have been disabled and error handling in reports doesn't work. For example, when I go to delete an object such as a form or report, I get no confirmation of any kind...it either works or it doesn't (doesn't work if I have the report open).
2
1835
by: Alex Maghen | last post by:
Hi. I've seen several KBs on using .NET for MS Office Automation. But I have a particular question: I am developing a somewhat stand-alone .ASPX page which will need to do some relatively simple MS Office Automation (Office 2003+). The .ASPX page is not part of a Web Forms Visual Studio project. It's just a stand-alone file. And therefore, there is not "References" setting or anything because there's no Visual Studio project. My...
4
1141
by: Arturo | last post by:
Hello everybody. Can someone have a look at this bit of code? Private Sub TestExcel() 'Create the Excel Application Dim xlExcel As Application = New Excel.Application xlExcel.DisplayAlerts = False Dim xlWorkbooks As Workbooks = xlExcel.Workbooks Try
2
1269
by: RJB | last post by:
I'm working on a VB application that must run 24x7 for a LONG time, think 60 days of so. As part of what it does it must automate an instance of IE and navigate to many different URLs, think many thousands. Issue 1: Most of the time, these navigations succeed. All is well. But, based on early runs, from time to time, say once or twice every 24 hrs IE inexplicably hangs and the automation object hangs, gets stuck, becomes...
3
1280
by: Richard Bell | last post by:
I'm working on a VB application that must run 24x7 for a LONG time, think 60 days of so. As part of what it does it must automate an instance of IE and navigate to many different URLs, think many thousands. Issue 1: Most of the time, these navigations succeed. All is well. But, based on early runs, from time to time, say once or twice every 24 hrs IE inexplicably hangs and the automation object hangs, gets stuck, becomes...
16
2979
by: RichardP | last post by:
Hi there everyone - I'm new to this forum. I am having an issue when running an application from an instance of Access which has been started through automation (early or late bound, makes no difference). No warning / confirmation messages are issued (eg. when running action queries, deleting records from a datasheet, deleting database objects such as tables).
10
3285
by: cj2 | last post by:
I open a word template in VB and add values to the bookmarks then save the document as as pdf. When I then go to close the document it pops up a save as dialog box. It's already saved the document in pdf and that is all I want done with it. How can I tell it to close the file without prompting me for anything? For Each row As DataRow In myDt.Rows Dim objWord As Application Dim objDoc As Document objWord =...
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.