Index
2001-05-16 15:11Brian.Searle@indsys.ge.com: RE: Word Automation/Bookmarks (was Word Headers)
2001-05-16 16:06Bill - Work email : Word Automation/Bookmarks (was Word Headers)
2001-05-20 20:07Cindy Winegarden : RE: Word Automation/Bookmarks (was Word Headers)
2001-05-20 21:39Bill Anderson : Character delimiters (was Word Automation/Bookmarks) (was Word Headers)
2001-05-20 22:32John Koziol : RE: Word Automation/Bookmarks (was Word Headers)
2001-05-20 22:56Cindy Winegarden : RE: Word Automation/Bookmarks (was Word Headers)
2001-05-20 23:01John Koziol : RE: Word Automation/Bookmarks (was Word Headers)
2001-05-21 08:20Tamu Green : RE: Character delimiters (was Word Automation/Bookmarks) (was Word Headers) (Out
2001-05-21 09:12John Koziol : RE: Character delimiters (was Word Automation/Bookmarks) (was Word Headers)
2001-05-21 09:23Jean-Marie Laeremans : Re: Character delimiters (was Word Automation/Bookmarks) (was Word Headers)
Back to top
RE: Word Automation/Bookmarks (was Word Headers)

Author: Brian.Searle@indsys.ge.com

Posted: 2001-05-16 15:11:44   Link

Bill,

Sorry, I've never done anything with bookmarks.

Brian Searle

brian.searle@indsys.ge.com

> -----Original Message-----

> From: Bill - Work email [mailto:bill.coupe@welove.com]

> Sent: Wednesday, May 16, 2001 4:06 PM

> To: Multiple recipients of ProFox

> Subject: Word Automation/Bookmarks (was Word Headers)

>

>

> Brian -

>

> Do you have a method for identifying (so that you can cycle

> through them)

> all the bookmarks on a given document?

>

> Ideal would be a way to load them into an array from whatever

> container

> holds them in the document.

>

> Thanks,

>

> -Bill

>

©2001 Brian.Searle@indsys.ge.com
Back to top
Word Automation/Bookmarks (was Word Headers)

Author: Bill - Work email

Posted: 2001-05-16 16:06:28   Link

Brian -

Do you have a method for identifying (so that you can cycle through them)

all the bookmarks on a given document?

Ideal would be a way to load them into an array from whatever container

holds them in the document.

Thanks,

-Bill

----- Original Message -----

From: <Brian.Searle@indsys.ge.com>

To: "Multiple recipients of ProFox" <profox@leafe.com>

Sent: Wednesday, May 16, 2001 1:27 PM

Subject: RE: Word Headers

> Ken,

>

> I spent a lot of time on an application using Word 97 last year. I know

how

> frustrating it can be to use the Object Browser in Word and convert VB

> constants to VFP equivalents.

>

> I've included some code to show how I set up a header for a first page

with a

> different one for the remaining pages.

>

> *-- Word header example

> oWord = CREATEOBJECT("Word.Application")

> oWord.CAPTION = "My Word Document"

> oDoc = oWord.documents.ADD()

> oWord.ActiveWindow.ActivePane.VIEW.TYPE = 3 && Set to page view

> oWord.VISIBLE = .T.

> oWord.WINDOWSTATE = 1

>

> *-- Set the page margins

> WITH oDoc.PageSetup

> .TopMargin = 20

> .BottomMargin = 40

> .LeftMargin = 57.5

> .RightMargin = 20

> ENDWITH

>

> *-- Set the header information for the top of each page

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION

> .PageSetup.DifferentFirstPageHeaderFooter = .T.

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> .FONT.SIZE = 8

> .FONT.BOLD = .F.

> .FONT.ITALIC = .F.

> .TypeText(CHR(13))

> .TypeText(CHR(9)+"First page info only")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

>

> WITH oWord.SELECTION

> .InsertBreak(7)

> .TypeText(CHR(9)+"Some stuff on another page")

> ENDWITH

>

> In the case that it matters, this runs using VFP6 SP4 and Word 97 (it

works in

> 2000 as well).

> HTH

>

> Brian Searle

> brian.searle@indsys.ge.com

>

>

> > -----Original Message-----

> > From: Teague Ken Contr ESC/XP [mailto:Ken.Teague@hanscom.af.mil]

> > Sent: Wednesday, May 16, 2001 10:54 AM

> > To: Multiple recipients of ProFox

> > Subject: Word Headers

> >

> >

> >

> > In creating a word document via automation I need to create

> > one header for

> > the first page, then a different header for the subsequent

> > pages. Do anyone

> > have code that I can use as guide to create?

> >

> >

> > Ken.Teague@Hanscom.AF.MIL

> >

> >

> >

> >

> > >

>

>

©2001 Bill - Work email
Back to top
RE: Word Automation/Bookmarks (was Word Headers)

Author: Cindy Winegarden

Posted: 2001-05-20 20:07:33   Link

Bill and Brian,

Forgive me if this has been answered already. There is a bookmarks

collection in the Word object model. Then you can use code like:

oWord = CREATEOBJECT([Word.Application])

oWord.Visible = .T.

oDocument = oWord.Documents.Add([MyDoc.DOC])

*!* Assume you've got some bookmarks in this document

FOR EACH oBookmark IN oDocument.Bookmarks

oBookmark.Select()

ENDFOR

Cindy Winegarden MCSD, MVP

cindy.winegarden@mvps.org

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of Bill -

Work email

Sent: Wednesday, May 16, 2001 4:06 PM

To: Multiple recipients of ProFox

Subject: Word Automation/Bookmarks (was Word Headers)

Brian -

Do you have a method for identifying (so that you can cycle through

them) all the bookmarks on a given document?

Ideal would be a way to load them into an array from whatever container

holds them in the document.

Thanks,

-Bill

----- Original Message -----

From: <Brian.Searle@indsys.ge.com>

To: "Multiple recipients of ProFox" <profox@leafe.com>

Sent: Wednesday, May 16, 2001 1:27 PM

Subject: RE: Word Headers

> Ken,

>

> I spent a lot of time on an application using Word 97 last year. I

> know

how

> frustrating it can be to use the Object Browser in Word and convert VB

> constants to VFP equivalents.

>

> I've included some code to show how I set up a header for a first page

with a

> different one for the remaining pages.

>

> *-- Word header example

> oWord = CREATEOBJECT("Word.Application")

> oWord.CAPTION = "My Word Document"

> oDoc = oWord.documents.ADD() oWord.ActiveWindow.ActivePane.VIEW.TYPE

> = 3 && Set to page view oWord.VISIBLE = .T.

> oWord.WINDOWSTATE = 1

>

> *-- Set the page margins

> WITH oDoc.PageSetup

> .TopMargin = 20

> .BottomMargin = 40

> .LeftMargin = 57.5

> .RightMargin = 20

> ENDWITH

>

> *-- Set the header information for the top of each page

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION .PageSetup.DifferentFirstPageHeaderFooter = .T.

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> .FONT.SIZE = 8

> .FONT.BOLD = .F.

> .FONT.ITALIC = .F.

> .TypeText(CHR(13))

> .TypeText(CHR(9)+"First page info only")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

>

> WITH oWord.SELECTION

> .InsertBreak(7)

> .TypeText(CHR(9)+"Some stuff on another page")

> ENDWITH

>

> In the case that it matters, this runs using VFP6 SP4 and Word 97 (it

works in

> 2000 as well).

> HTH

>

> Brian Searle

> brian.searle@indsys.ge.com

>

>

> > -----Original Message-----

> > From: Teague Ken Contr ESC/XP [mailto:Ken.Teague@hanscom.af.mil]

> > Sent: Wednesday, May 16, 2001 10:54 AM

> > To: Multiple recipients of ProFox

> > Subject: Word Headers

> >

> >

> >

> > In creating a word document via automation I need to create one

> > header for the first page, then a different header for the

> > subsequent pages. Do anyone

> > have code that I can use as guide to create?

> >

> >

> > Ken.Teague@Hanscom.AF.MIL

©2001 Cindy Winegarden
Back to top
Character delimiters (was Word Automation/Bookmarks) (was Word Headers)

Author: Bill Anderson

Posted: 2001-05-20 21:39:08   Link

I've used brackets as character delimiters for 13 years. Works just

fine, and it avoids conflicts with single and double quotes.

Bill Anderson

John Koziol wrote:

> Hmmm....OK, if it works what-the-hell!

©2001 Bill Anderson
Back to top
RE: Word Automation/Bookmarks (was Word Headers)

Author: John Koziol

Posted: 2001-05-20 22:32:25   Link

OK, I'm gonna assume there is a compelling reason for the brackets in place

of the normal quotes.... ;-)

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com]On Behalf Of Cindy

Winegarden

Sent: Sunday, May 20, 2001 8:08 PM

To: Multiple recipients of ProFox

Subject: RE: Word Automation/Bookmarks (was Word Headers)

Bill and Brian,

Forgive me if this has been answered already. There is a bookmarks

collection in the Word object model. Then you can use code like:

oWord = CREATEOBJECT([Word.Application])

oWord.Visible = .T.

oDocument = oWord.Documents.Add([MyDoc.DOC])

*!* Assume you've got some bookmarks in this document

FOR EACH oBookmark IN oDocument.Bookmarks

oBookmark.Select()

ENDFOR

Cindy Winegarden MCSD, MVP

cindy.winegarden@mvps.org

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of Bill -

Work email

Sent: Wednesday, May 16, 2001 4:06 PM

To: Multiple recipients of ProFox

Subject: Word Automation/Bookmarks (was Word Headers)

Brian -

Do you have a method for identifying (so that you can cycle through

them) all the bookmarks on a given document?

Ideal would be a way to load them into an array from whatever container

holds them in the document.

Thanks,

-Bill

----- Original Message -----

From: <Brian.Searle@indsys.ge.com>

To: "Multiple recipients of ProFox" <profox@leafe.com>

Sent: Wednesday, May 16, 2001 1:27 PM

Subject: RE: Word Headers

> Ken,

>

> I spent a lot of time on an application using Word 97 last year. I

> know

how

> frustrating it can be to use the Object Browser in Word and convert VB

> constants to VFP equivalents.

>

> I've included some code to show how I set up a header for a first page

with a

> different one for the remaining pages.

>

> *-- Word header example

> oWord = CREATEOBJECT("Word.Application")

> oWord.CAPTION = "My Word Document"

> oDoc = oWord.documents.ADD() oWord.ActiveWindow.ActivePane.VIEW.TYPE

> = 3 && Set to page view oWord.VISIBLE = .T.

> oWord.WINDOWSTATE = 1

>

> *-- Set the page margins

> WITH oDoc.PageSetup

> .TopMargin = 20

> .BottomMargin = 40

> .LeftMargin = 57.5

> .RightMargin = 20

> ENDWITH

>

> *-- Set the header information for the top of each page

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION .PageSetup.DifferentFirstPageHeaderFooter = .T.

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> .FONT.SIZE = 8

> .FONT.BOLD = .F.

> .FONT.ITALIC = .F.

> .TypeText(CHR(13))

> .TypeText(CHR(9)+"First page info only")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

>

> WITH oWord.SELECTION

> .InsertBreak(7)

> .TypeText(CHR(9)+"Some stuff on another page")

> ENDWITH

>

> In the case that it matters, this runs using VFP6 SP4 and Word 97 (it

works in

> 2000 as well).

> HTH

>

> Brian Searle

> brian.searle@indsys.ge.com

>

>

> > -----Original Message-----

> > From: Teague Ken Contr ESC/XP [mailto:Ken.Teague@hanscom.af.mil]

> > Sent: Wednesday, May 16, 2001 10:54 AM

> > To: Multiple recipients of ProFox

> > Subject: Word Headers

> >

> >

> >

> > In creating a word document via automation I need to create one

> > header for the first page, then a different header for the

> > subsequent pages. Do anyone

> > have code that I can use as guide to create?

> >

> >

> > Ken.Teague@Hanscom.AF.MIL

©2001 John Koziol
Back to top
RE: Word Automation/Bookmarks (was Word Headers)

Author: Cindy Winegarden

Posted: 2001-05-20 22:56:16   Link

JK,

I do a lot of SQL Pass-through involving the use of internal quotes.

Brackets solve so many problems that I began using them everywhere.

Consider the following:

cMySQL = ;

[SELECT * FROM MyTable ] + ;

[WHERE MyField = "Adam's Apple" ]

Cindy Winegarden MCSD, MVP

cindy.winegarden@mvps.org

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of John

Koziol

Sent: Sunday, May 20, 2001 10:32 PM

To: Multiple recipients of ProFox

Subject: RE: Word Automation/Bookmarks (was Word Headers)

OK, I'm gonna assume there is a compelling reason for the brackets in

place of the normal quotes.... ;-)

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com]On Behalf Of Cindy

Winegarden

Sent: Sunday, May 20, 2001 8:08 PM

To: Multiple recipients of ProFox

Subject: RE: Word Automation/Bookmarks (was Word Headers)

Bill and Brian,

Forgive me if this has been answered already. There is a bookmarks

collection in the Word object model. Then you can use code like:

oWord = CREATEOBJECT([Word.Application])

oWord.Visible = .T.

oDocument = oWord.Documents.Add([MyDoc.DOC])

*!* Assume you've got some bookmarks in this document

FOR EACH oBookmark IN oDocument.Bookmarks

oBookmark.Select()

ENDFOR

Cindy Winegarden MCSD, MVP

cindy.winegarden@mvps.org

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of Bill -

Work email

Sent: Wednesday, May 16, 2001 4:06 PM

To: Multiple recipients of ProFox

Subject: Word Automation/Bookmarks (was Word Headers)

Brian -

Do you have a method for identifying (so that you can cycle through

them) all the bookmarks on a given document?

Ideal would be a way to load them into an array from whatever container

holds them in the document.

Thanks,

-Bill

----- Original Message -----

From: <Brian.Searle@indsys.ge.com>

To: "Multiple recipients of ProFox" <profox@leafe.com>

Sent: Wednesday, May 16, 2001 1:27 PM

Subject: RE: Word Headers

> Ken,

>

> I spent a lot of time on an application using Word 97 last year. I

> know

how

> frustrating it can be to use the Object Browser in Word and convert VB

> constants to VFP equivalents.

>

> I've included some code to show how I set up a header for a first page

with a

> different one for the remaining pages.

>

> *-- Word header example

> oWord = CREATEOBJECT("Word.Application")

> oWord.CAPTION = "My Word Document"

> oDoc = oWord.documents.ADD() oWord.ActiveWindow.ActivePane.VIEW.TYPE

> = 3 && Set to page view oWord.VISIBLE = .T.

> oWord.WINDOWSTATE = 1

>

> *-- Set the page margins

> WITH oDoc.PageSetup

> .TopMargin = 20

> .BottomMargin = 40

> .LeftMargin = 57.5

> .RightMargin = 20

> ENDWITH

>

> *-- Set the header information for the top of each page

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION .PageSetup.DifferentFirstPageHeaderFooter = .T.

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> .FONT.SIZE = 8

> .FONT.BOLD = .F.

> .FONT.ITALIC = .F.

> .TypeText(CHR(13))

> .TypeText(CHR(9)+"First page info only")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

>

> WITH oWord.SELECTION

> .InsertBreak(7)

> .TypeText(CHR(9)+"Some stuff on another page")

> ENDWITH

>

> In the case that it matters, this runs using VFP6 SP4 and Word 97 (it

works in

> 2000 as well).

> HTH

>

> Brian Searle

> brian.searle@indsys.ge.com

>

>

> > -----Original Message-----

> > From: Teague Ken Contr ESC/XP [mailto:Ken.Teague@hanscom.af.mil]

> > Sent: Wednesday, May 16, 2001 10:54 AM

> > To: Multiple recipients of ProFox

> > Subject: Word Headers

> >

> >

> >

> > In creating a word document via automation I need to create one

> > header for the first page, then a different header for the

> > subsequent pages. Do anyone have code that I can use as guide to

> > create?

> >

> >

> > Ken.Teague@Hanscom.AF.MIL

©2001 Cindy Winegarden
Back to top
RE: Word Automation/Bookmarks (was Word Headers)

Author: John Koziol

Posted: 2001-05-20 23:01:13   Link

Hmmm....OK, if it works what-the-hell!

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com]On Behalf Of Cindy

Winegarden

Sent: Sunday, May 20, 2001 10:56 PM

To: Multiple recipients of ProFox

Subject: RE: Word Automation/Bookmarks (was Word Headers)

JK,

I do a lot of SQL Pass-through involving the use of internal quotes.

Brackets solve so many problems that I began using them everywhere.

Consider the following:

cMySQL = ;

[SELECT * FROM MyTable ] + ;

[WHERE MyField = "Adam's Apple" ]

Cindy Winegarden MCSD, MVP

cindy.winegarden@mvps.org

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of John

Koziol

Sent: Sunday, May 20, 2001 10:32 PM

To: Multiple recipients of ProFox

Subject: RE: Word Automation/Bookmarks (was Word Headers)

OK, I'm gonna assume there is a compelling reason for the brackets in

place of the normal quotes.... ;-)

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com]On Behalf Of Cindy

Winegarden

Sent: Sunday, May 20, 2001 8:08 PM

To: Multiple recipients of ProFox

Subject: RE: Word Automation/Bookmarks (was Word Headers)

Bill and Brian,

Forgive me if this has been answered already. There is a bookmarks

collection in the Word object model. Then you can use code like:

oWord = CREATEOBJECT([Word.Application])

oWord.Visible = .T.

oDocument = oWord.Documents.Add([MyDoc.DOC])

*!* Assume you've got some bookmarks in this document

FOR EACH oBookmark IN oDocument.Bookmarks

oBookmark.Select()

ENDFOR

Cindy Winegarden MCSD, MVP

cindy.winegarden@mvps.org

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of Bill -

Work email

Sent: Wednesday, May 16, 2001 4:06 PM

To: Multiple recipients of ProFox

Subject: Word Automation/Bookmarks (was Word Headers)

Brian -

Do you have a method for identifying (so that you can cycle through

them) all the bookmarks on a given document?

Ideal would be a way to load them into an array from whatever container

holds them in the document.

Thanks,

-Bill

----- Original Message -----

From: <Brian.Searle@indsys.ge.com>

To: "Multiple recipients of ProFox" <profox@leafe.com>

Sent: Wednesday, May 16, 2001 1:27 PM

Subject: RE: Word Headers

> Ken,

>

> I spent a lot of time on an application using Word 97 last year. I

> know

how

> frustrating it can be to use the Object Browser in Word and convert VB

> constants to VFP equivalents.

>

> I've included some code to show how I set up a header for a first page

with a

> different one for the remaining pages.

>

> *-- Word header example

> oWord = CREATEOBJECT("Word.Application")

> oWord.CAPTION = "My Word Document"

> oDoc = oWord.documents.ADD() oWord.ActiveWindow.ActivePane.VIEW.TYPE

> = 3 && Set to page view oWord.VISIBLE = .T.

> oWord.WINDOWSTATE = 1

>

> *-- Set the page margins

> WITH oDoc.PageSetup

> .TopMargin = 20

> .BottomMargin = 40

> .LeftMargin = 57.5

> .RightMargin = 20

> ENDWITH

>

> *-- Set the header information for the top of each page

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 9

>

> WITH oWord.SELECTION .PageSetup.DifferentFirstPageHeaderFooter = .T.

> .ParagraphFormat.TabStops.ClearAll

> .ParagraphFormat.ALIGNMENT = 0

> .ParagraphFormat.TabStops.ADD(380)

> .TypeText(CHR(13)+CHR(13)+CHR(13))

> .FONT.NAME = "Times New Roman"

> .FONT.SIZE = 16

> .FONT.BOLD = .T.

> .FONT.ITALIC = .T.

> .TypeText(CHR(9)+"My Logo")

> .HeaderFooter.Shapes.AddLine(58, 94, 461, 94)

> * .HeaderFooter.Shapes.AddPicture(sys(5)+"mylogo.gif")

> .TypeText(CHR(13))

> .FONT.SIZE = 8

> .FONT.BOLD = .F.

> .FONT.ITALIC = .F.

> .TypeText(CHR(13))

> .TypeText(CHR(9)+"First page info only")

> .TypeText(CHR(13))

> ENDWITH

>

> oWord.ActiveWindow.ActivePane.VIEW.SeekView = 0

>

> WITH oWord.SELECTION

> .InsertBreak(7)

> .TypeText(CHR(9)+"Some stuff on another page")

> ENDWITH

>

> In the case that it matters, this runs using VFP6 SP4 and Word 97 (it

works in

> 2000 as well).

> HTH

>

> Brian Searle

> brian.searle@indsys.ge.com

>

>

> > -----Original Message-----

> > From: Teague Ken Contr ESC/XP [mailto:Ken.Teague@hanscom.af.mil]

> > Sent: Wednesday, May 16, 2001 10:54 AM

> > To: Multiple recipients of ProFox

> > Subject: Word Headers

> >

> >

> >

> > In creating a word document via automation I need to create one

> > header for the first page, then a different header for the

> > subsequent pages. Do anyone have code that I can use as guide to

> > create?

> >

> >

> > Ken.Teague@Hanscom.AF.MIL

©2001 John Koziol
Back to top
RE: Character delimiters (was Word Automation/Bookmarks) (was Word Headers) (Out

Author: Tamu Green

Posted: 2001-05-21 08:20:59   Link

I will be out of the Office until May 23, 2000. I will get back with you =

as soon as possible. Thank you and have a nice day.

©2001 Tamu Green
Back to top
RE: Character delimiters (was Word Automation/Bookmarks) (was Word Headers)

Author: John Koziol

Posted: 2001-05-21 09:12:51   Link

Hmmm...I used to use them as delimiters eons ago under DOS but I guess I had

plain forgotten about them. Thanks all, for the heads-up on their

continuing functionality.

-----Original Message-----

From: profox@leafe.com [mailto:profox@leafe.com]On Behalf Of Jean-Marie

Laeremans

Sent: Monday, May 21, 2001 3:23 AM

To: Multiple recipients of ProFox

Subject: Re: Character delimiters (was Word Automation/Bookmarks) (was

Word Headers)

On Sun, 20 May 2001 21:39:08 -0700, you wrote:

>

>I've used brackets as character delimiters for 13 years. Works just

>fine, and it avoids conflicts with single and double quotes.

>

>Bill Anderson

>

Same here...especially when one is dealing with languages like French

JML

©2001 John Koziol
Back to top
Re: Character delimiters (was Word Automation/Bookmarks) (was Word Headers)

Author: Jean-Marie Laeremans

Posted: 2001-05-21 09:23:00   Link

On Sun, 20 May 2001 21:39:08 -0700, you wrote:

>

>I've used brackets as character delimiters for 13 years. Works just=20

>fine, and it avoids conflicts with single and double quotes.

>

>Bill Anderson

>

Same here...especially when one is dealing with languages like French

JML

©2001 Jean-Marie Laeremans