Running into Error 462: The remote server machine does not exist

Tr3yAnderson

New Member
Joined
Aug 31, 2015
Messages
16
Hey guys, I have a macro where it saves a word file; however, it won't always run, everyone once in awhile it throws the error 462: The remote server machine does not exist. or it'll throw an error saying can't find active document. it will work through once I go to the task manager and close out any orphaned Word processes. Does anyone know what I can add to my code to not have any orphaned Word processes, or if there are some, to clear them out? I thought by closing out my macro by setting wordapp to nothing and quitting Word would do it but it does not fix it.

Thanks,

Sub Save_Narrative() 'This Saves the Narrative as a word file and as a PDF in a designated folder
Dim wordApp As Word.Application
Dim wordDoc As Word.document
Dim DocName As String
Dim NewdocName As String




Set wordApp = Nothing

Set wordApp = CreateObject("Word.Application")


Set wordDoc = ActiveDocument


DocName = wordDoc.Name




'Save as word file
wordDoc.SaveAs FileName:=([redacted])


'remove .docx from file name
NewdocName = Left(DocName, Len(DocName) - 5) & ".pdf"


'save as PDF
wordDoc.SaveAs FileName:=([redacted]), FileFormat:=17




wordDoc.Close SaveChanges:=False
Set wordDoc = Nothing
wordApp.Quit
Set wordApp = Nothing



End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Also I will note that using ActiveDocument script instead of naming it was on purpose as the document is pulled from a web based application.
 
Upvote 0
I'm not sure I see what the use of the new "WordApp" is. It looks like you create it, do some work (not using it - using whatever is running the code), then destroy it.

It's also possible that the reason it works after you remove orphaned processes isn't directly related to the orphaned processes. Hard to say though. You would still want to remove orphaned processes but there's probably more to this than just this macro.
 
Upvote 0
Yes, to explain the purpose a little better. I download from a company based web application that has cases we are working on. we go through several a day. we edit these cases and then save them as a word doc and PDF. rather than having to manually save the files every case I do, I wrote this macro to do all the saving for me. I just can't figure out why it won't run every time. If it runs just fine the first time, then the second time I get the error. then if I close out the word process in task manager and run again it runs just fine. Hopefully that helps clarify a bit more
 
Upvote 0
It's hard to say. Something crucial here would be the filenaming (since you can't save files with the same name). But that logic is hidden/obscured. Also not clear where/how this is being run (in a script, from Excel, from Word, in a personal word or excel macroworkbook, in some other kind of excel or word workbook. Also since the error message refers to remote machines it isn't clear if you are actually working with remote machines (?) or not. A lot of unknowns.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top