Locking a picture in the header

J

jeanmac

I did a bit more research on my question regarding locking a logo in the
header so that it could not be accessed without protecting the document. I
found some really useful code on the MVP site thet sends the focus back to
the main document if you try to access the header or footer. However,
although it works some of the time at other times when I try to go into the
header it gives me a run-time error instead of immediately sending me back to
the main document. I am using Word XP, does anyone have any idea why it is
failing? The code was provided by Bill Coan and I am sure it is me who is
messing it up, it is at the following site:

http://word.mvps.org/FAQs/Customization/ProtectWord2000PlusHeader.htm

Any help would be really appreciated.

Thanks
Jeanmac
 
D

Doug Robbins

When you get the error, if you click on Debug, what line of the code is
highlighted?

--
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
 
J

jeanmac

Thanks for coming back. The line of code that is highlighted is

ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

Cheers
Jeanmac
 
J

jeanmac

Forgot to mention, in addition to the line of code below being highlighted,
the run-time error states: Run time error 91 - Object variable with block
variable not selected.

Hope that helps. Thanks for your time.
 
B

Bill Coan

Hi Jeanmac,

Have you noticed any special conditions associated with the error? For
example, does the document view or the current selection (insertion point, a
graphic selected, text selected, etc.) or the method of accessing the header
(double-click, View>>Header and Footer) or anything else seem to be
involved?
 
J

jeanmac

Hello

Thanks for replying. I have noticed that mostly the error occurs when
opening Word for the first time. I have opened a document based on the
template using both the General Templates link and the link to the template
itself. I have always used the menu commands to view the header/footer.

The error code is Run Time Error 91, Object variable with block variable not
selected.

Many thanks for your help
Jeanmac
 
J

jeanmac

Hello again,

I've just had a brainwave, which is unusual for me. I typed ActiveDocument
in front of the line of code which had the error after opening Word for the
first time and clicking on a template link (see my earlier reply). Anyway it
worked!!! I've tested it again and again and I don't have the error any more.
Maybe it's because I'm using Word XP rather than Word 2000.

Hurrah!!!!! Thanks.
 

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