GetObject Statement Causes Error 462 - Remote Server Does Not Exist...

Soule

Registered User.
Local time
Yesterday, 17:43
Joined
Jan 6, 2012
Messages
28
Hi, All,
I'm getting an Error 462 "the remote server machine does not exist or is unavailable" with this GetObject statement. I'm trying to open an Outlook .oft template through a form command button with code in standard module (which I'll later move to class code-behind-form).
My environment is:
- an .accdb Db
- Access 2007 on Windows XP on company network
- I have Outlook open.
- I'm in datasheet view on my form.
- I have sufficient DAO and ActiveX library references checked.

The GetObject line is where it's hanging up. It causes my msgbox to fire with the 462 error. I understand the fix of adding your dimensioned variable name to the beginning of a CreateObject statement, such as "Dim mWord As Object...Set mWord = CreateObject("Word.Application")...mWord.Documents.Add oDocs & "odis_PPS_100_CaseClosing.dot", but I don't see a related fix for GetObject statements.

I can't find a solution online anywhere. I think most people are using UNC pathnames with GetObject statements, and I'm in a networked environment where I can't (a UNC pathname because the class "Outlook.Application" causes a 432 error and I can't configure my registry on my work server).

Here is the GetObject part of my code:

Code:
Option Explicit
Option Compare Database
' Note: Prior to this automation code, a "Lostfocus event procedure" code will run
' (populating the form's "Movie Code" control) when the user tabs through it.
' This first code procedure simply defines the error handling type in the event of.
Public Sub SafeStart()
Application.SetOption "Error Trapping", 1
End Sub
Public Sub A1_Form_Re_send_Welcome_E_Mail_Only_Button_Click()
' Re-send only employee Outlook e-mail populated with Access data using Outlook .oft template by clicking button.
' For code leaness, automation will draw on data in controls of record showing, not underlying table.
' To facilitate this, first procedure is a save record.
' Used GetObject method rather than CreateItemFromTemplate method for simplicity.
' Namespace/MAPI commands not used as some employees are on mail client other than Outlook.
' Automation code begins here:
' On button click but before e-mail procedures begin, record will be saved to table but REMAIN ONSCREEN (not go to new,
' blank record), code can draw data from the data-entry form.
' This first line of code saves record.
 
DoCmd.RunCommand acCmdSaveRecord
 
' This next procedure opens Outlook by retrieving employee welcome e-mail template...
' Could not use more stable UNC path to file because of network registry issues affecting class portion of pathname.
' The error lines in this & each forthcoming procedure block simply tell the code where to go in event of error.
 
On Error GoTo PROC2_ERR
 
Dim objOutlookMsg As Object
Set objOutlookMsg = GetObject("J:\Database Work\A1 Tracking DB & Related\A1 Form Button Automation Email Templates\Employee A1 Welcome 
Outlook Template.oft")  <-------- the statement doesn't wrap in my actual code.
 
Debug.Print "Open Outlook by getting template object", Err.Number, Err.Description
 
PROC2_EXIT:
Exit Sub
 
PROC2_ERR:
MsgBox "Error opening Outlook by getting template object." & vbCrLf & Err.Number & Err.Description, vbExclamation + vbOKOnly, "Open Outlook Through Template"
 
Resume PROC2_EXIT.
..

...goes to End Sub, etc.. after this.

This code compiles okay, but returns a 432 error on that line in run-time. Thank you so much ahead of time for your thoughts on this problem.

Frank

This post is also here: http://www.utteraccess.com/forum/Getobject-Statement-Erro-t1982286.html#entry2209555
and here:
http://www.accessforums.net/showthread.php?p=104538#post104538
 
Last edited:
I guess it's not liking the fact that you're using a mapped drive.

However, here are two suggestions:

1. Write it in this form:
Code:
Set objOutlookMsg = GetObject("J:[COLOR=Red]\\[/COLOR]Database Work\A1 Tracking DB & Related\A1 Form Button Automation Email Templates\Employee A1 Welcome 
Outlook Template.oft")
Note the extra forward slash I added there.

OR

2. Do the following:
* Get an instance of Outlook
* Use one of the appropriate methods of Outlook to open the template. I believe one you could use is called something like Create From Template. I don't know the exact name of the method. You should be able to find that out.

In both methods use two forward slashes as already noted.

By the way, that's a long path.
 

Users who are viewing this thread

Back
Top Bottom