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...
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 replace 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!
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 replace 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!