Question : ActiveDocument.SaveAs getting error message

Hello - this code does a simple, one-letter mail merge, and worked fine, without the SaveAs, but the client wants to save the result on his network. The ActiveDocument.SaveAs gets the following error message:

     Object doesn't support this property or method

I thought it might need the named argument, then maybe that it didn't like the file name path I was stringing together, but it still gets the same error.

What am I missing, please?  (this VBA is being run from Access 2003, to Word 2003)

Thanks

Mark
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Dim objWord As Word.Document
    Set objWord = GetObject("C:\JRT\Docs\Submittal Letter.doc", "Word.Document")
    objWord.Application.Visible = True
    
    objWord.MailMerge.OpenDataSource _
        Name:=GetCurrentDBNamePath_TSB(), _
        LinkToSource:=True, _
        SQLStatement:="SELECT * FROM [tblJobsCandsMMrgDSrc]"
    
    objWord.MailMerge.Execute
    
    'objWord.ActiveDocument.SaveAs FileName:=strLtrName
    objWord.ActiveDocument.SaveAs FileName:="C:\testsave.doc"
    
    objWord.Close

Answer : ActiveDocument.SaveAs getting error message

I always like to start with an Application object and open files from there.

Dim objWordApp As Word.Application
Dim objWordDoc As Word.Document
    Set objWordApp = CreateObject"Word.Application")

    Set objWordDoc = objWordApp.Documents.Open("C:\JRT\Docs\Submittal Letter.doc", "Word.Document")
    objWordApp .Visible= True

That way I don't get confused about the object type. A document object doesn't have an ActiveDocument method/Property

I think this is what you meant.

objWord.Application.ActiveDocument.SaveAs FileName:="C:\testsave.doc"
   
 
Random Solutions  
 
programming4us programming4us