Word Templates and Saving as Documents (1 Viewer)

smallh

New member
Local time
Today, 07:52
Joined
Feb 12, 2003
Messages
6
I have a word template that is opened from access 97. If you then goto save the document in word it will only allow you to save it as a template. Does anyone know how to open a template in word as a document??

This is the code that I'm currently using, any suggestions are welcome.

Helen


Private Sub Fax_Click()



Const DOC_PATH As String = "C:\My Documents"
Const doc_name As String = _
"F1002 - Fax Header R2.dot"

Dim appWord As Object
Dim doc As Word.Document
Dim myTable As Word.table
Dim myRange As Word.Range


On Error Resume Next

Set appWord = GetObject(, "Word.Application")
If Err = 429 Then
Set appWord = New Word.Application
Err = 0
End If

On Error GoTo Err_Fax_Click
With appWord

Dim docNa As String
docNa = DOC_PATH + doc_name

.documents.Open docNa
.documents(docNa).Activate

Set myTable = .ActiveDocument.Tables(1)
myTable.Cell(2, 1).Range.text = Parent.[A First Name] & " " & Parent.[A Surname] & vbCr & Parent.[B First Name] & " " & Parent.[B Surname] & vbCr & "Chris" & vbCr & "Sean" & vbCr & Parent.[Homebuyer Sales subform].Form.[Sales Advisor1]
myTable.Cell(6, 1).Range.text = Nz(Parent.[A Fax]) & vbCr & Parent.[B Fax] & vbCr & "01276 471892" & vbCr & "01276 850519" & vbCr & Parent.[Homebuyer Sales subform].Form.[Sales Advisor Fax]
myTable.Cell(9, 1).Range.text = Parent.[Project] & " " & Parent.[Plot#]
Dim pars As Integer
pars = doc.Paragraphs.count
Set myRange = doc.Range(Start:=doc.Paragraphs(pars).Range.End - 1, End:=doc.Paragraphs(pars).Range.End - 1)
myRange.InsertAfter Me.Note

.Visible = True
.Activate


End With

Set doc = Nothing
Set appWord = Nothing

Exit_Fax_Click:
Exit Sub

Err_Fax_Click:
MsgBox Err.Description

Set doc = Nothing
Set appWord = Nothing
Resume Exit_Fax_Click

End Sub
 

Tim K.

Registered User.
Local time
Today, 07:52
Joined
Aug 1, 2002
Messages
242
Force it to save to a new file name.

.ActiveDocument.SaveAs FileName:="c:\newfilename.doc", FileFormat:=0 'wdFormatDocument

:)
 

Users who are viewing this thread

Top Bottom