Doble click event in visio

Hello everybody. I have a question I have a code that change the width and height of a shape when user click in a shape and I want that  when the user click a shape change the width and height of a shape, and when the user click again same shape, change width and heigth to normal values. I did a code using a count but is not working, count variable do not change

Dim shape1 As shape


Set shape1 = Application.ActivePage.Shapes("AP1")

If count > 0 Then
shape1.Cells("Width").Formula = "0 mm"
shape1.Cells("Height").Formula = "0 mm"

count = 0


End If


If count = 0 Then
shape1.Cells("Width").Formula = "7,333 mm"
shape1.Cells("Height").Formula = "22 mm"


count = count + 1

End If

November 25th, 2014 10:30pm

The basic problem is that the variable "count" in not kept. Every time you call your routine a new "count" is created.

Two ways of doing this:

  1. Store the value "count" within the shape, have a look at Shape Data
  2. Instead of using a variable, use the width or height as the value you compare with

e.g. If shape1.Cells("Width").Formula = "=0 mm"

Free Windows Admin Tool Kit Click here and download it now
November 25th, 2014 11:28pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics