Steve-vfp9user
Programmer
Hi
I have been reading up Tamar Granor & Della Martin's Automating Microsoft Word and have a question with regards to using a Word document that we have created with a preset header (that contains an image and header text) and also a preset footer (this contains business details and page number of pages).
The start of the coding from TG & DM looks like this:
Having read through the document, I'm not sure what I need to change so I can use our document which is held at:
d:\ourdocuments\quotes\default.doc
I tried:
This gives an error of "oWord" not found.
The rest of the coding I can change to use the fields and data from a table etc so no problem there, it's just the original default document we would like to use. I can post the whole block of code if required albeit I'm not sure it's required.
Any pointers would be appreciated.
Thank you
Steve
I have been reading up Tamar Granor & Della Martin's Automating Microsoft Word and have a question with regards to using a Word document that we have created with a preset header (that contains an image and header text) and also a preset footer (this contains business details and page number of pages).
The start of the coding from TG & DM looks like this:
Code:
#Define CR Chr(13)
#Define wdStyleTypeParagraph 1
#Define wdStyleNormal -1
#Define wdAlignParagraphLeft 0
#Define wdAlignParagraphCenter 1
#Define wdCollapseEnd 0
Use _Samples + "TasTrade\Data\Customer"
Local oWord, oDocument, oRange
Local oBodyStyle, oMajorHeadingStyle, oMinorHeadingStyle
oWord = Createobject("Word.Application")
oWord.Visible = .T.
oDocument = oWord.Documents.Add() && Use the Normal template
oRange = oDocument.Range()
* Set up styles. Base body style on Normal.
oBodyStyle = oDocument.Styles.Add( "Body", wdStyleTypeParagraph )
With oBodyStyle
More code here....
Having read through the document, I'm not sure what I need to change so I can use our document which is held at:
d:\ourdocuments\quotes\default.doc
I tried:
Code:
oDocument = GetObject("ourdocuments\quotes\default.doc")
oDocument = oWord.Documents.Open("ourdocuments\quotes\default.doc")
This gives an error of "oWord" not found.
The rest of the coding I can change to use the fields and data from a table etc so no problem there, it's just the original default document we would like to use. I can post the whole block of code if required albeit I'm not sure it's required.
Any pointers would be appreciated.
Thank you
Steve