[AccessD] Runtimes - Preferably AccessXPbut2003ifabsolutelyrequired

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Tue Jan 30 08:54:58 CST 2007


I will give that a roll.  The funny (not ha-ha) part is that everything
works on my box and fails on theirs.  We're both running O2003.

Thanks,

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell
Sent: Tuesday, January 30, 2007 4:39 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Runtimes - Preferably
AccessXPbut2003ifabsolutelyrequired

On 1/29/07, Rocky Smolin at Beach Access Software <rockysmolin at bchacc.com>
wrote:

> I'm still having trouble with a user opening a word doc and the code 
> works here.  So I'm switching to late binding.
>
> Would the correct code for late binding be:
>
> Dim objWord As Object
> Set objWord = GetObject("", "Word.Application")

Rocky,

GetObject will only work if you have Word open. It will fail miserable if
Word isn't.

Here is how I deal with it:

dim objWord as Object

'Get Word Object
'Bypass error handling
On Error Resume Next
'Reuse Word object if open
Set objWord = GetObject(, "Word.Application") If Err.Number = 429 Then '
Check to see if we got a Word Object
    'Don't have a Word Object, so we need to create one
    Set objWord = CreateObject("Word.Application") End If 'Reset Error
Handling On Error GoTo 0

What this chunk does is tries to reuse an open Word instance. If there is no
Word instance it will create one.

--
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well preserved
body, but rather to skid in sideways, totally worn out, shouting "What a
great ride!"
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.14/658 - Release Date: 1/29/2007
2:49 PM
 




More information about the AccessD mailing list