The remote Server Machine does not Exist or is unavailable

RichRod

New member
Local time
Today, 15:04
Joined
Jun 23, 2009
Messages
7
Hello Everyone. I have been using this code for years with no problem and now when I open a word document from Access, I get all the revisions. So, I found these settings called acvtivewindow. It works the very first time through. However, after that, you get the error that is in my title every time. Here is my Code:

Public Sub open_Word_Doc(strDocName As String)

' Created by Chuck Anderson Info Systems Dept - 12/07/2006

' Remarks>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' Module will build the path and name of a file based upon the Appeal Number
' and then open a Word Document

Dim MS_Word As Object
Dim strPath As String
Dim strMessage As String

'Define the path of the document

strPath = "\\SolidVM\data\Pres\POOL\IEB_Decisions\" & strDocName & ".doc"

' Check to see if the file exists
If Dir(strPath) <> "" Then
Set msword = CreateObject(Class:="Word.Application") 'Create an instance of MS Word

msword.Visible = True


msword.Documents.Open strPath 'Open the Document


ActiveWindow.View.RevisionsView = wdRevisionsViewFinal
ActiveWindow.View.ShowRevisionsAndComments = False


Else
strPath = "\\SolidVM\data\Pres\POOL\IEB_Decisions\" & strDocName & ".docx" ' See if it is an Office 2007 or > file
If Dir(strPath) <> "" Then
Set msword = CreateObject(Class:="Word.Application") 'Create an instance of MS Word
msword.Visible = True

msword.Documents.Open strPath 'Open the Document

ActiveWindow.View.RevisionsView = wdRevisionsViewFinal
ActiveWindow.View.ShowRevisionsAndComments = False
Else
strMessage = Trim("File " & strDocName & ".doc" & " does not exist")
MsgBox (strMessage)
End If
End If
End Sub

Any idea's on how to fix this issue? I have tried running the database from the server folder where the documents exist, but it still behaves the same way.
 
Public Sub open_Word_Doc(strDocName As String)

' Created by Chuck Anderson Info Systems Dept - 12/07/2006

' Remarks>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' Module will build the path and name of a file based upon the Appeal Number
' and then open a Word Document

Dim MS_Word As Object
Dim strPath As String
Dim strMessage As String

'Define the path of the document

strPath = "FilePath" & strDocName & ".doc"

' Check to see if the file exists
If Dir(strPath) <> "" Then
Set msword = CreateObject(Class:="Word.Application") 'Create an instance of MS Word
msword.Visible = True

msword.Documents.Open strPath 'Open the Document

msword.ActiveWindow.View.RevisionsView = wdRevisionsViewFinal
msword.ActiveWindow.View.ShowRevisionsAndComments = False

Else
Call open_Word_Docx(strDocName)

End If
End Sub
Public Sub open_Word_Docx(strDocName As String)

' Created by Chuck Anderson Info Systems Dept - 12/07/2006

' Remarks>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' Module will build the path and name of a file based upon the Appeal Number
' and then open a Word Document

Dim MS_Word As Object
Dim strPath As String
Dim strMessage As String

'Define the path of the document

strPath = "filepath" & strDocName & ".docx"

' Check to see if the file exists
If Dir(strPath) <> "" Then
Set msword = CreateObject(Class:="Word.Application") 'Create an instance of MS Word
msword.Visible = True

msword.Documents.Open strPath 'Open the Document

msword.ActiveWindow.View.RevisionsView = wdRevisionsViewFinal
msword.ActiveWindow.View.ShowRevisionsAndComments = False

Else
strMessage = Trim("File " & strDocName & ".doc" & " does not exist")
MsgBox (strMessage)
End If
End Sub
 
All that needed to be done was add the prefix "msword." to the ActiveWindow declarations and it all worked great!
 
Thanks Bob for your article. Wish I would of had it before I spent two days chasing this thing!
 
@BobLarson I wanted to say thanks for your link. I don't know how many times I did this to myself and each time I come around to this thread.

In my latest self sabotoge I did this.

Code:
        Set myRange = oDoc.Content
        With myRange
          .Collapse Direction:=wdCollapseEnd
          .InsertParagraphAfter
          .Collapse Direction:=wdCollapseEnd
        End With
        t = t + 1
        oDoc.Tables.Add Range:=myRange, numRows:=1, numcolumns:=2
        oDoc.Tables(t).TopPadding = InchesToPoints(0)
        oDoc.Tables(t).BottomPadding = InchesToPoints(0)
        oDoc.Tables(t).LeftPadding = InchesToPoints(0)
        oDoc.Tables(t).RightPadding = InchesToPoints(0)
        oDoc.Tables(t).Range.ParagraphFormat.SpaceAfter = 6
        oDoc.Tables(t).Range.Style = oWord.ActiveDocument.Styles("No Spacing")
        oDoc.Tables(t).Range.Font.Name = "Arial"
        oDoc.Tables(t).Range.Font.Size = 12
And this works.

Code:
        Set myRange = oDoc.Content
        With myRange
          .Collapse Direction:=wdCollapseEnd
          .InsertParagraphAfter
          .Collapse Direction:=wdCollapseEnd
        End With
        t = t + 1
        oDoc.Tables.Add Range:=myRange, numRows:=1, numcolumns:=2
        oDoc.Tables(t).TopPadding = oWord.InchesToPoints(0)
        oDoc.Tables(t).BottomPadding = oWord.InchesToPoints(0)
        oDoc.Tables(t).LeftPadding = oWord.InchesToPoints(0)
        oDoc.Tables(t).RightPadding = oWord.InchesToPoints(0)
        oDoc.Tables(t).Range.ParagraphFormat.SpaceAfter = 6
        oDoc.Tables(t).Range.Style = oWord.ActiveDocument.Styles("No Spacing")
        oDoc.Tables(t).Range.Font.Name = "Arial"
        oDoc.Tables(t).Range.Font.Size = 12
if anyone spots it I was fine in one of the Global Objects and not on the other. The good one being ActiveDocument where i had oWord.ActiveDocument. The other being InchesToPoints - which when it's oWord.InchesToPoints it is just fine.

As a reference, Microsoft's usually useless help pages does have a list of Global Objects that you need to watch for.

https://support.microsoft.com/en-us/kb/319832

With Word it's
ActiveDocument, ActiveWindow, Selection, Documents, Dialogs, FileConverters, InchesToPoints, WordBasic
 

Users who are viewing this thread

Back
Top Bottom