View Single Post
 
Old 05-07-2014, 05:18 PM
steveneashcraft steveneashcraft is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: May 2014
Posts: 8
steveneashcraft is on a distinguished road
Default

I am using the SaveAs method and I am setting the format but Word still prompts me as the file that I have open is rtf. If I have opened a file whose internal format is Word doc then Word doesn't display the Save dialog. Here's some code


Code:
Private Sub Form_Load()
On Error GoTo testerr
Dim WW As Object
Dim FileName As String
Dim SaveFormat As Long
FileName = "C:\tmp\test.doc"
SaveFormat = 0
Set WW = CreateObject("Word.Application")
WW.Visible = True
WW.Documents.Open FileName
WW.activedocument.SaveAs FileFormat:=SaveFormat
WW.activedocument.Close
 
Exit Sub
testerr:
MsgBox ("error occurred " & Err.Description)
End Sub
You need to create c:\tmp\test.doc as a file with an internal format of rtf.
Word still allows you to do that but you will have to rename the file to test.doc.
Create a VB6 project with just a form and run it.
Save dialog will come up every time and I have no idea how to tell Word that I really want to save this file as a file with doc or docx internal format.

Too bad Word keeps getting modified so that it is "better".

If you create a file that is really a doc file and run the code then Save dialog does not come up.

I'm open to any thoughts on how I can do this from a MS MVP Word expert.
Currently probably going to have go with a kludge like ClickOff.

Thanks

Last edited by macropod; 05-07-2014 at 06:54 PM. Reason: Added code tags
Reply With Quote