Save as a word document

S

sadsfan

I have written a macro that has created a custom save button. However after I
have used it once Word keeps on trying to save the document as a HTML web
page, rather than a word Document (doc). My code is below, does anyone know
what I might need to add to prevent this?

Sub New_Report()
'
'Save document and use result from "Name" form field as save filename
With Dialogs(wdDialogFileSaveAs)
.Name = ActiveDocument.FormFields("Text16").Result
.Show
End With

'Save old document and assign it to a variable

Dim ofile As Document
Set ofile = ActiveDocument

'Open a new document and close old

Documents.Add Template:=ActiveDocument.AttachedTemplate.FullName, _
DocumentType:=wdDocument, Visible:=True
ofile.Close


End Sub
 
S

sadsfan

The code is designed to open a new document and close the old, promting a
save as dialog box. Do i need to change this and actually specify a location
to save to, or can I ensure the save as dialog box always has *.doc as the
file type?
 

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