From: JediKaiti on
Hello! I have an AutoNew() macro in a Word 2007 template, and I have a
question about saving the document as a PDF file.

My macro, among other things, does this:
With ActiveDocument
.SaveAs .AttachedTemplate.Path & "\Handbook.pdf", FileFormat:=17
End With

I am wondering if it is possible, and if so how, to have the macro
automatically set the option to create bookmarks from the headers in the
document? Right now it only does so if the person using the template has that
option set. I'd like to have the macro set it for them.

Thanks!
From: Doug Robbins - Word MVP on
Instead of using .SaveAs, use the .ExportAsFixedFormat Method and then you
can use the wdExportCreateHeadingBookmarks attribute, which if set to 1 will
create a bookmark in the exported document for each heading within the main
document and text boxes.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"JediKaiti" <JediKaiti(a)discussions.microsoft.com> wrote in message
news:C98DF983-00FC-4045-A536-FD2569EF4158(a)microsoft.com...
> Hello! I have an AutoNew() macro in a Word 2007 template, and I have a
> question about saving the document as a PDF file.
>
> My macro, among other things, does this:
> With ActiveDocument
> .SaveAs .AttachedTemplate.Path & "\Handbook.pdf", FileFormat:=17
> End With
>
> I am wondering if it is possible, and if so how, to have the macro
> automatically set the option to create bookmarks from the headers in the
> document? Right now it only does so if the person using the template has
> that
> option set. I'd like to have the macro set it for them.
>
> Thanks!

From: JediKaiti on
That did it, thanks!

"Doug Robbins - Word MVP" wrote:

> Instead of using .SaveAs, use the .ExportAsFixedFormat Method and then you
> can use the wdExportCreateHeadingBookmarks attribute, which if set to 1 will
> create a bookmark in the exported document for each heading within the main
> document and text boxes.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>
> "JediKaiti" <JediKaiti(a)discussions.microsoft.com> wrote in message
> news:C98DF983-00FC-4045-A536-FD2569EF4158(a)microsoft.com...
> > Hello! I have an AutoNew() macro in a Word 2007 template, and I have a
> > question about saving the document as a PDF file.
> >
> > My macro, among other things, does this:
> > With ActiveDocument
> > .SaveAs .AttachedTemplate.Path & "\Handbook.pdf", FileFormat:=17
> > End With
> >
> > I am wondering if it is possible, and if so how, to have the macro
> > automatically set the option to create bookmarks from the headers in the
> > document? Right now it only does so if the person using the template has
> > that
> > option set. I'd like to have the macro set it for them.
> >
> > Thanks!
>