Re: How do I resolve: Requested operation is presently disabled when calling a Visio Shape object via a loop?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On May 29, 6:48 pm, Paul Herber
<SubstituteMyFirstNameH...@xxxxxxxxxxx> wrote:
On Thu, 29 May 2008 14:57:03 -0700 (PDT), eggmatt...@xxxxxxxxx wrote:
I receive the following error when I try to write to a text property
of a shape object. I am coding in Perl using a win32::OLE module. So
my problem is trying to loop through a set of Visio objects, change
some text, and write to the object where I want to change. The sample
code is:
#Grab some text from a shape. VB would be: VShape.Text (where
Vshape is built from the visio document.pages.Item.shapes.shape and so
on . . .

my $prompt = $VShape->{Text};

#Here is the loop where I have ported into an array
(successfully) a list of what text is in the Visio -
Original_Array_list and what I want to change it to: Different_Array.

for ($i = $#Original_Array_list; $i >=0; $i--)
{
if (defined $prompt)
{
#This regex changes prompt to the Value of Different_Array
if the Original_Array[$i] element is present
if ($prompt =~ s/$Original_Array_list[$i]/
$Different_Array_List[$i]/g)
{
# this is where the exception is thrown:
$VShape->{Text} = $prompt;
delete($EnglishPrompts[$i]);
delete($SpanishPrompts[$i]);
}
}

Your code attempts to change the shape's test. Does this bit work
correctly? The two "delete" lines, what are they trying to do? What is
in the two arrays? Which line causes the exception? (Delete each line
in turn to find out !)

--
Regards, Paul Herber, Sandrila Ltd.http://www.sdl.sandrila.co.uk/ SDL/MSC/TTCN/URN/UML2 for Visio


Well, it only works if the shape has been created - which just gave me
an idea - or I am calling it once, ot recursively or in a loop.It
fails when called there. I forgot to change the array names in delete
lines. They should be Original_arraylist and Different_array. I am
delelting them since I am doing an exponential search and replace, I
want to optimize that by deleting vaulues that have already been used.
.



Relevant Pages

  • Re: Shape Change event not working.
    ... > There's an exception in the code that wasn't propogating to a MessageBox. ... >> - I am adding the event handlers to the Visio Application object instead ... >>> AddAdvise) your suggested events are not being caught. ... >>> int eventID, ...
    (microsoft.public.visio.developer)
  • Re: Off-page reference return to calling page
    ... here is to hoping visio 2010 pulls more intelligence into shapesheet and less ... page a, knowning its going after b, puts a marker in page b (setref in a ... Regards, Paul Herber, Sandrila Ltd. http://www.pherber.com/ ...
    (microsoft.public.visio.general)
  • Re: Editing Shape text boxes when the Text Tool is selected
    ... I have had this happening in four separate instances of Visio ... "Paul Herber" wrote: ... ensure your video display drivers are up to date ... reduce/stop any hardware acceleration on your video card ...
    (microsoft.public.visio)
  • Re: measurment in fraction form
    ... such that the entry for area, as set in the Shapesheet> User-defined Cells ... display of the area value. ... > Regards, Paul Herber, Sandrila Ltd. ... > Electronics Packages for Visio ...
    (microsoft.public.visio.general)
  • Re: Instruction pointer not going pass the other line
    ... Can anyone tell me what is the reason? ... You'll have better luck posting your question in a newsgroup specific to the automation of Visio. ... You didn't even post enough code to show what type "Node" is, but if it's a value type, it's possible there's something in the default constructor for the type that is causing an exception. ... it's always possible NodeLimit is too large and the array allocation simply fails. ...
    (microsoft.public.dotnet.languages.csharp)