Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009
    Posts
    6

    Unanswered: Vista / Office07 issues?

    I have a access database that creates and saves a word document from info inputted to a form. It all worked well until a recent update to our systems to Vista and Office 07. Now when the command button to transfer the data to the word document is used the document still opens but you get an error message that says

    Error No: -2147417851; Method 'SaveAs' of Object'_Document' Failed

    I have google the error message but cannot find any answers.

    Any help would be appriciated.

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    What is the code behind the button? It's hard to diagnose without knowing what we're diagnosing

    As a shot in the dark, I would first recommend you check your references and make sure the right version of the Word library is checked.
    Me.Geek = True

  3. #3
    Join Date
    Aug 2009
    Posts
    6
    Sorry here is the code

    Private Sub Command27_Click()

    On Error GoTo ErrorHandler
    Dim appWord As Word.Application
    Dim docs As Word.Documents
    Dim doc As Word.Document
    Dim strTemplatePath As String
    Dim strDocsPath As String
    Dim strWordTemplate As String
    Dim prps As Object
    Dim strSaveName As String
    Dim strSaveNamePath As String

    Dim strFirstName As String
    Dim strShortDate As String
    strFirstName = Nz(Me![ItemCode])

    strShortDate = Format(date, "m - d - yy")

    strWordTemplate = "PARA Request.dot"
    strTemplatePath = "\\carsdoima7x0034\users$\B\todd-brisben\Shared\"
    strWordTemplate = strTemplatePath & strWordTemplate
    strSaveName = "NOTAM " & strFirstName & " " & strShortDate & ".doc"
    strDocsPath = "\\carsdoima7x0034\users$\B\todd-brisben\Shared\NOTAMs\"
    strSaveNamePath = strDocsPath & strSaveName
    Set appWord = CreateObject(Class:="Word.Application")

    Set docs = appWord.Documents
    Set doc = docs.Add(strWordTemplate)
    Set prps = doc.CustomDocumentProperties

    On Error Resume Next
    prps.Item("ItemCode").Value = Nz(Me![ItemCode])
    prps.Item("POC").Value = Nz(Me![POC])
    prps.Item("Unit").Value = Nz(Me![Unit])
    prps.Item("Phone").Value = Nz(Me![Phone])
    prps.Item("Facility").Value = Nz(Me![Facility])
    prps.Item("CoOrd").Value = Nz(Me![CoOrd])
    prps.Item("Event").Value = Nz(Me![Event])
    prps.Item("St_Date").Value = Nz(Me![St_Date])
    prps.Item("End_Date").Value = Nz(Me![End_Date])
    prps.Item("St_BlockTime").Value = Nz(Me![St_BlockTime])
    prps.Item("End_BlockTime").Value = Nz(Me![End_BlockTime])
    prps.Item("TypeAC").Value = Nz(Me![typeAC])
    prps.Item("NumAC").Value = Nz(Me![NumAC])
    prps.Item("NumSorties").Value = Nz(Me![NumSorties])
    prps.Item("CallSigns").Value = Nz(Me![CallSigns])
    prps.Item("MaxAltitude").Value = Nz(Me![MaxAltitude])
    prps.Item("Remarks").Value = Nz(Me![Comments])
    prps.Item("St_BlockTime2").Value = Nz(Me![St_BlockTime2])
    prps.Item("End_BlockTime2").Value = Nz(Me![End_BlockTime2])
    prps.Item("RequestDate").Value = Nz(Me![RequestDate])
    prps.Item("Daily1").Value = Nz(Me![Daily1])
    prps.Item("Daily2").Value = Nz(Me![Daily2])
    prps.Item("SL").Value = Nz(Me![SL])
    prps.Item("HALO").Value = Nz(Me![HALO])
    prps.Item("HAHO").Value = Nz(Me![HAHO])
    prps.Item("Bundle").Value = Nz(Me![Bundle])

    On Error GoTo ErrorHandler
    With appWord
    .Visible = True
    .Selection.WholeStory
    .Selection.Fields.Update
    .ActiveDocument.SaveAs strSaveNamePath
    .Activate
    .Selection.EndKey Unit:=wdStory
    End With
    ErrorHandlerExit:
    Exit Sub
    ErrorHandler:
    MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
    Resume ErrorHandlerExit

    End Sub

  4. #4
    Join Date
    May 2005
    Posts
    1,191
    Again, I'd suggest checking your libraries.

    If those check out, the only other thing I can think of off the top of my head is to remove the spaces from the filename, but I don't think that would be the problem...
    Me.Geek = True

  5. #5
    Join Date
    Aug 2009
    Posts
    6
    All libraries seem correct. Went back and tried a back up and updated templates to 07with same results. Word doc opens and fills correctly but will not automatically save like before.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •