ActivePage is obliterated after using DrawingControl.Src

D

das_at_gehc

Hi all,

I'm seeing an issue that I hope someone can explain and help.

Basically, I'm trying to embed a visio application and mostly it seems to
work except when I try to do:

Document.Pages.Add()

after setting the DrawingControl.Src value.

The exception thrown is "Requested operation is presently disabled." on the
Add() call.

Extensive debugging investigation led me to discover that
Application.ActivePage gets obliterated after setting DrawingControl.Src.


// From the Visio Documentation:
// To save changes in a file,
// first use the Src property to load the file into the
control,
// and then set Src to an empty string ("").
drawingControl.Src = fileName; // THIS WIPES OUT THE
ACTIVEPAGE!!!!
Page apage = drawingControl.Document.Pages.Add(); //
exception thrown

Hopefully this is enough of clues to whet the curiosity of the experts out
there to show me the way to accomplish this correctly (or provide a
workaround?) -- if not, I will gladly followup with more.

Thanks in advance.
 
S

Sander

Hi all,

I'm seeing an issue that I hope someone can explain and help.

Basically, I'm trying to embed a visio application and mostly it seems to
work except when I try to do:

Document.Pages.Add()

after setting the DrawingControl.Src value.

The exception thrown is "Requested operation is presently disabled." on the
Add() call.

Extensive debugging investigation led me to discover that
Application.ActivePage gets obliterated after setting DrawingControl.Src.


// From the Visio Documentation:
// To save changes in a file,
// first use the Src property to load the file into the
control,
// and then set Src to an empty string ("").
drawingControl.Src = fileName; // THIS WIPES OUT THE
ACTIVEPAGE!!!!
Page apage = drawingControl.Document.Pages.Add(); //
exception thrown

Hopefully this is enough of clues to whet the curiosity of the experts out
there to show me the way to accomplish this correctly (or provide a
workaround?) -- if not, I will gladly followup with more.

Thanks in advance.

Hi there,

Just to be sure we're both talking about the same thing here, what type is
your drawingControl object?

I did not set an Src property on any object, but I do get the same exception.
In my program the error does occur when automating Visio 2003, but it does not
in Visio 2002.

The only thing I found that *might* be causing the exception is in the remarks
on this page:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/vissdk11/html/vimthAdd.asp
(mind the linebreak)

Pages.Add is disabled when markup tracking is on in Microsoft Office Visio.

However, markup tracking is disabled by default when a new document is created.


BTW. I think microsoft.public.visio.developer is a better place for this
question.

Thanks in advance.
 
Top