Word.View.set_SeekView unavailable in Word 2003

F

Frenchy

Hi all,

I developed an add-in in C# VS 2003 (extensibility project) for Word 2003.

I have a big bug that I really can't understand;

I've created a commandbar with one combobox and one button.

I tried to do exactly the same things in the Events Combo changed and Button
Clicked. (I did this just for test).

When I click the button everything goes fine, but when I select something in
the comboBox I have this error;
__________
System.Runtime.InteropServices.COMException (0x800A11FD): This command is
not available.
at Word.View.set_SeekView(WdSeekView prop)
at Addin1.Connect.AddWatermark(String WatermarkText) in
c:\dvp\c#\vs2003\addinok\connect.cs:line 930
___________

And here's the line where is the error :
this.appWord.ActiveWindow.ActivePane.View.SeekView =
Word.WdSeekView.wdSeekCurrentPageHeader;

So I don't understand why I can access the header/footer from a button click
and not from a combobox...GRRRRRRRRRRRRRRRRRRRRRRR

I have to add one thing: I have this problem since I protect the Section 1
of my document. But in the beginning of my code I Unprotect It (and It works
when I click the button)...I'm sure nobody will find the solution and I'm
becoming CRAZY AAARGGGgg
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RnJlbmNoeQ==?=,

I'm not really sure I follow everything that's supposed to be happening, here.

Do you have EXACTLY the same code behind the button as well as in the action
for the combo box (not "sure" but "yes, both are calling the same procedure, so
it must be the same")? It would really help if you could show us the procs. Do
check that the document is truly unprotected before the line that goes into the
header/footer.

Normally, one doesn't try to display the header/footer. Do you explicitly want
to do so, or are you really interested in writing information to this area? If
the latter, you shouldn't be trying to put the selection there. You should be
writing to the RANGE.

One major problem with headers/footers and trying to show the "current" one is
that Word doesn't always try to open the one you think it would, given the
current selection. It often tries to open a different one. Could be that
nothing is even defined in the one its trying to open.
I developed an add-in in C# VS 2003 (extensibility project) for Word 2003.

I have a big bug that I really can't understand;

I've created a commandbar with one combobox and one button.

I tried to do exactly the same things in the Events Combo changed and Button
Clicked. (I did this just for test).

When I click the button everything goes fine, but when I select something in
the comboBox I have this error;
__________
System.Runtime.InteropServices.COMException (0x800A11FD): This command is
not available.
at Word.View.set_SeekView(WdSeekView prop)
at Addin1.Connect.AddWatermark(String WatermarkText) in
c:\dvp\c#\vs2003\addinok\connect.cs:line 930
___________

And here's the line where is the error :
this.appWord.ActiveWindow.ActivePane.View.SeekView =
Word.WdSeekView.wdSeekCurrentPageHeader;

So I don't understand why I can access the header/footer from a button click
and not from a combobox...GRRRRRRRRRRRRRRRRRRRRRRR

I have to add one thing: I have this problem since I protect the Section 1
of my document. But in the beginning of my code I Unprotect It (and It works
when I click the button)...I'm sure nobody will find the solution and I'm
becoming CRAZY AAARGGGgg

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
F

Frenchy

Hello,

Yes in fact I call the same procedure...
In fact what I wanted to do is to protect the first page (cover sheet). But
by protecting this first page which is my first section, It also protects my
header, footer, custom properties,...

So there's a bug between the fact to unprotect the document from the
combobox changed event, I don't know why, there's no reason because it works
with a click on button.

So here's how I did to avoid this: I don't use the method protect of Word, I
use the "WindowSelectionChange" event; if the user clicks on the first page,
then I put the selection to the second page (there's always a second page).

Doing this I don't need to unprotect then reprotect my first page, and the
rest of my code works fine.

I also tried the range from the header/footer (after the unprotect), if I
change the text every thing is fine. But if I try to change the color,
bold,... Word crash! (and I put a try catch, but It really crash It doesn't
go in my catch lol...really strange

But as I said, now I don't have the problem because I don't protect my
document.

Thanks Cindy
 

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