Retrieveing Header/Footer in VBA

R

Radrizzi Gilles

Hi there,
Currently, I am developing an Add-In for Office Products which retrieves the
Header/Footer from a template file and copies that in the currently opened
document. This is a requirement from the company I work for as they request
all their documents to have the same Header/Footer.

So I can do it for Word, Excel, Powerpoint, Visio. All of these allow to
access the information stored in the Header/Footer using specific properties.
So I can open the template, retrieve the info and copy it to the currently
active document.
However, I can't seem to find something similar for MSProject. I am able to
SET a Header/Footer in the Active Document using the
FilePageSetupHeader/Footer methods, but I can't find a way to retrieve that
info from the template.

I read something about a blob of binary data called
"MSP_PROJECTS:RESERVED_BINARY_DATA" where this information is supposed to be
stored, but I have no idea where to find that. I'm not even sure if that is
still true as the post dated back to 2000.

Btw, I'm using MSProject 2002. The Add-In is a VB.NET Add-In.

I hope someone can help me with this.
 
E

Ed Morrison

Try the FilePageSetupHeader and FilePageSetupFooter methods for modifying
the header and footer info.
 
R

Radrizzi Gilles

Hi Ed,
Thanks for your answer. However, it wasn't of any help to me. I might have
explained badly what I was trying to achieve in my first post.

I am aware of the FilePageSetupFooter and FilePageSetupHeader methods.
However, they are used to SET the Footer/Header. What I need to do is GET the
Header/Footer.

I'll try to explain using an example:
I have an MSProject File "Project1.mpp" with no Header/Footer. Also, there
is a MSProject Template called "Template.mpt" which contains the Standart
HEadder/Footer for our company.
Now what I need to do is GET the Header/Footer from Template.mpt and copy it
into Project1.mpp so that this document has our standart Header/Footer
without the user having to bother. (Project1.mpp might be an older file with
info in it. So I can't just create a new document from the template)

So I do following steps in code:
1) Open Project1.mpp
2) Open Template.mpt
3) GET Header/Footer from Template.mpt <-- This is what I don't know how to do
4) SET the Header/Footer in Project1.mpp (using the info retrieved in Step
3). This I can do using FilePageSetupHeader/Footer methods

I hope I have been more clear now.
 
J

Jan De Messemaeker

Hi,

Yes, you are absolutely clear, but I fail to see how you can get the
header/footer.
Many Project Objects are "Write-Only".
What you could do:
- Define the header-footer in code and set it at Project Open to the right
view
- Or copy a whole wiew (AFAIK headers and footers belong to the view) but
then other view properties like bar styles and text styles come with it)
HTH
 
R

Radrizzi Gilles

Hi,
Thanks for the answer.
That is actually what I feared. I thought it would be possible as I am doing
it for Word, Excel, Powerpoint and Visio. So I guessed Project would allow to
do it too.

Well, I'll try what you suggested with copying the whole view
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top