How do I resolve: Requested operation is presently disabled whencalling a Visio Shape object via a l

E

eggmatters

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]);
}
}
 
P

Paul Herber

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 !)
 
G

Guy..L

I receive this error message when the shape is on a layer that is locked or
when I try to drop a shape from a master that claims to belong to an already
document-scope-locked layer.
 
E

eggmatters

Hmmm, That may be the case. This Visio may be locked down. I will look
into it. Thanks for your input!

I receive this error message when the shape is on a layer that is locked or
when I try to drop a shape from a master that claims to belong to an already
document-scope-locked layer.

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]);
}
}
 
E

eggmatters

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 !)


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.
 
D

Dieter Sternberg

Check, if you are accessing a shape that is already deleted.
If you are holding references to shapes in an array and then delete
shapes via Shape.Delete the Shape is internally gone but you still hold
the pointer to the COM wrapper of the shape.
Then accessing this shape gives you different error messages,
depending which property is being accessed.

Regards
Dieter
 

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