Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"save as" that preserves more than just the content...

Status
Not open for further replies.

dmodele

Technical User
Jul 30, 2002
19
0
0
US
Im working on a project that involves creating dynamic documents an access module from tables and then sending the content to word documents and I got stuck in a very early stage. I posted this to another forum I think it might be more appropriate for this one...

As a first step/test, I tried to just open up an instance of word, open up the pre-formatted starting word document, and then "save as" to a new title. Eventually, I will be replacing some text etc.. but for now I just wanted to see that I could open the document and properly do the save as. The problem I ran into is that when I looked at the saved document and compared it to the original, I noticed that all the formatting was gone... every line was center aligned, the fonts were all the same, nothing was bolded.. basically, I lost all the formatting. I have no idea what I did wrong.. can someone help? here is the code that I used:

------------------------------------------------------
Private Sub Test_Click()

Set WordInst = CreateObject("word.application")
Set WordDoc = WordInst.Documents.Open("C:\Documents and... ...Settings\dmodele\Desktop\nifty\templateDEMOGRAPHICS.doc")
c = WordDoc.content

'some code that I will do to the content, some replaces mostly

WordDoc.content = c
WordDoc.SaveAs ("C:\Documents and... ...Settings\dmodele\Desktop\nifty\Demographics.doc")
WordDoc.Close
WordInst.Quit

End Sub
------------------------------------------------
what am I missing? please help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top