question

amosmadanes-4376 avatar image
0 Votes"
amosmadanes-4376 asked

run-time error '462' the remote server machine does not exist or is unavailable.

I am trying to email a screenshot of userForm with outlook. The spreadsheet is saved in our company google drive and works without a hitch in a couple of computers, but in most It stops with the above error.

The code for the email function is:

Function outlookEmail()
Dim doc As Object

Dim OutApp As Outlook.Application 'this is an outlook object
Dim oOutlookEmail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set oOutlookEmail = OutApp.CreateItem(0)

 On Error Resume Next
 Set OutApp = GetObject(, "Outlook.Application")
 If Err.Number > 0 Then Set OutApp = CreateObject("Outlook.Application")
 On Error GoTo 0
    
    
 Application.SendKeys "(%{1068})"
 DoEvents
    
 With oOutlookEmail
     .Display
     Set doc = .GetInspector.WordEditor
     doc.Range(0, 0).Paste
     .To = sDetail.Cells(myRow, headerDict.item("email"))
     .Subject = "documents for you"
      Application.Wait (Now + TimeValue("0:00:01"))
      Application.SendKeys "%s"
     .Send
 End With

End Function


the error usually occurs in the set doc line.


office-outlook-itprooffice-vba-devoffice-scripts-excel-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers