INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

VBScript error 462

VBScript error 462

(OP)
I have a simple vbscript which sends an email through outlook. The vbscript works fine on most machines except one machine which returns an error of 462. Can anyone help me resolve this issue.

CODE --> vbscript

Dim OutApp
 Dim objNS
 Dim OutMail
 Dim strbody
 Dim SigString
 Dim Signature

 Set OutApp = CreateObject("Outlook.Application")
 Set objNS = OutApp.GetNamespace("MAPI")
 OutApp.Session.Logon
 Set OutMail = OutApp.CreateItem(0)

newsignature = Replace( "<html><head><meta http-equiv=Chr(34)Content-
TypeChr(34) content=Chr(34)text/html; charset=utf-8Chr(34)></head><body>
<font face=Chr(34)TahomaChr(34)><font size=2>Dear<br><br><br><br>Kind 
regards</font></font> <br><br> </body></html>", "Chr(34)", """")

On Error Resume Next
 With OutMail
          .To = "kevin@inlinesolutions.co.za"
          .CC = ""
          .BCC = ""
          .Subject = "test"
          .HTMLBody = newsignature
           Err.Clear
.Attachments.Add("C:\Users\Kevin Mortimer\Desktop\62983.pdf")
          If Err.Number <> 0 Then
          MsgBox "Error Attaching Document:( " & Err.Number & " ) " & Err.Description
          Err.Clear
          End If
          .Send
 End With

 On Error GoTo 0
 Set Signature = Nothing
 Set SigString = Nothing
 Set strBody = Nothing
 Set OutMail = Nothing
 Set objNS = Nothing
 Set OutApp = Nothing 

RE: VBScript error 462

One description I read said

Error: 462
Error (Hex): 1CE
Source: Microsoft VBScript runtime error
Description: The remote server machine does not exist or is unavailable

which might indicated you can't reach the file location or you don't have permissions to it.

Simi

RE: VBScript error 462

Read these threads:
http://www.outlookcode.com/threads.aspx?forumid=1&...
http://www.outlookcode.com/codedetail.aspx?id=83
https://social.msdn.microsoft.com/Forums/sharepoin...

The suggestion is:
  1. to use CreateObject only when GetObject is Nothing
  2. to use GetNamespace("MAPI")
i.e. finally something like this -see the 3.link above

CODE

On Error Resume Next
  Set OutlookApp = GetObject(, "Outlook.Application")
  On Error GoTo 0
  If OutlookApp Is Nothing Then
    Set OutlookApp = CreateObject("Outlook.Application")
  End If
  Dim Session As Object
  Set Session = OutlookApp.GetNamespace("MAPI")
  Session.Logon 

RE: VBScript error 462

(OP)
Thanks all for the advice. I have made those changes but i now get this error, see attached. Just to give you an idea of what is happening. I am trying to send emails to about 10 people. The vbscript files are created and then run. Is there a limit to how many of these vbscript files can run at the same time?

RE: VBScript error 462

Quote:


Is there a limit to how many of these vbscript files can run at the same time
I thought that you run only one script file at the same time.

RE: VBScript error 462

(OP)
i run a looping script in my database that cycles through the recipients and creates the custom vbscript code for each recipients, runs that code then goes onto the next recipient and does the same. THis happens very fast but has never been a problem before. I have been able to do this on over 100 recipients before with no problem. Just having a problem on this one machine. May be a problem with the Outlook installation. I will try run the loop with some pauses to see if that helps

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close