abouting opening a rtf file in a word Template Access 97

  • Thread starter Tahseena Ishrat Ahmed
  • Start date
T

Tahseena Ishrat Ahmed

Dear Group

I have opened a word template file in access 97.
My Word version is word 2003.
I want to open a rtf file or a doc file in this template.

The code is listed below. Please give me a solution how to do that.

Function Open_WordDoc()
On Error GoTo Err_Open_WordDoc

Dim doc As Object
Dim wrdApp As Object
Dim DocPath As String


DocPath = "H:\DocumentTemplate.dot"


DoCmd.OutputTo acOutputReport, "ReportTest", acFormatRTF,
"H:\ReportTest.rtf", False

Set wrdApp = GetObject(, "word.application")
On Error Resume Next


With wrdApp

Set doc = .Documents.Add(Template:=DocPath, NewTemplate:=False,
DocumentType:=0)
.Documents.Open "H:\ReportTest.rtf"

End With

wrdApp.Visible = True
wrdApp.Activate
doc.Activate
Exit_Open_WordDoc:
Set doc = Nothing
Set wrdApp = Nothing
Exit Function

Err_Open_WordDoc:

MsgBox Err.Description
Set wrdApp = CreateObject("Word.Applicatipon")
Resume Next

End Function
 
A

a a r o n . k e m p f

a) don't use old versions of software-- it's just not secure
b) use real reports instead of mail merge / access crap
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top