Changing shapes in VBA Code 
Author Message
 Changing shapes in VBA Code

i am using this function to find any changes on the current page in Visio
and i have a custom field thats has a shape type in it. so if some one where
to change it from Hexagon to Square, i want the shape to chane to what they
typed in.

this is what i have done so far:

Private WithEvents actPage As Visio.Page

Private Sub actPage_CellChanged(ByVal Cell As IVCell)
    Dim val As String
        val = "hexagon"
        if val = Cell.shape then
            cell.shape="square"
        end if

End Sub

Private Sub Document_DocumentOpened(ByVal doc As Visio.IVDocument)

    Set actPage = Visio.ActivePage

End Sub



Mon, 25 Jul 2005 04:10:12 GMT  
 Changing shapes in VBA Code
so can someone help me with this or is this something that
you have not tried to do?

Thanks
Jim

Quote:
>-----Original Message-----
>i am using this function to find any changes on the

current page in Visio
Quote:
>and i have a custom field thats has a shape type in it.

so if some one where
Quote:
>to change it from Hexagon to Square, i want the shape to
chane to what they
>typed in.

>this is what i have done so far:

>Private WithEvents actPage As Visio.Page

>Private Sub actPage_CellChanged(ByVal Cell As IVCell)
>    Dim val As String
>        val = "hexagon"
>        if val = Cell.shape then
>            cell.shape="square"
>        end if

>End Sub

>Private Sub Document_DocumentOpened(ByVal doc As
Visio.IVDocument)

>    Set actPage = Visio.ActivePage

>End Sub

>.



Sun, 31 Jul 2005 06:23:25 GMT  
 Changing shapes in VBA Code
Jim:

What exactly do you want to have happen here?  For example, do you want some
VBA to change the geometry of the existing shape? Or do you want some VBA to
delete that shape and replace it with another?

At any rate, a number of the statements in your sample code don't seem to be
doing sensible things, for example:

  cell.shape="square"

so perhaps you might be helped out quite a bit by the Developing Visio
Solutions book that is completely available through the msdn.microsoft.com
library:

msdn.microsoft.com/library/en-us/devref/HTML/DVS_00_Preface_540.asp?

Graham

--
-----------------------------------------
Graham Wideman
Visio 2002 Developer's Survival Pack
diagramantics.com

Quote:
> so can someone help me with this or is this something that
> you have not tried to do?

> Thanks
> Jim

> >-----Original Message-----
> >i am using this function to find any changes on the
> current page in Visio
> >and i have a custom field thats has a shape type in it.
> so if some one where
> >to change it from Hexagon to Square, i want the shape to
> chane to what they
> >typed in.

> >this is what i have done so far:

> >Private WithEvents actPage As Visio.Page

> >Private Sub actPage_CellChanged(ByVal Cell As IVCell)
> >    Dim val As String
> >        val = "hexagon"
> >        if val = Cell.shape then
> >            cell.shape="square"
> >        end if

> >End Sub

> >Private Sub Document_DocumentOpened(ByVal doc As
> Visio.IVDocument)

> >    Set actPage = Visio.ActivePage

> >End Sub

> >.



Tue, 02 Aug 2005 17:05:22 GMT  
 Changing shapes in VBA Code
Graham:

What I'm trying to do is on change of a cell I want to change the shape to
what ever I put in the cell. so if the shape is a Hexagon then one of the
custom property has it shape in it, so when I change it to Square I want the
shape to change to a square. So from what I have been able to read from your
book I got yesterday, it looks like I need to create a new shape copy the
information over and then delete the shape.

I think I may be on the right track now, but any input is greatly appreciate

Jim



Quote:
> Jim:

> What exactly do you want to have happen here?  For example, do you want
some
> VBA to change the geometry of the existing shape? Or do you want some VBA
to
> delete that shape and replace it with another?

> At any rate, a number of the statements in your sample code don't seem to
be
> doing sensible things, for example:

>   cell.shape="square"

> so perhaps you might be helped out quite a bit by the Developing Visio
> Solutions book that is completely available through the msdn.microsoft.com
> library:

> msdn.microsoft.com/library/en-us/devref/HTML/DVS_00_Preface_540.asp?

> Graham

> --
> -----------------------------------------
> Graham Wideman
> Visio 2002 Developer's Survival Pack
> diagramantics.com


> > so can someone help me with this or is this something that
> > you have not tried to do?

> > Thanks
> > Jim

> > >-----Original Message-----
> > >i am using this function to find any changes on the
> > current page in Visio
> > >and i have a custom field thats has a shape type in it.
> > so if some one where
> > >to change it from Hexagon to Square, i want the shape to
> > chane to what they
> > >typed in.

> > >this is what i have done so far:

> > >Private WithEvents actPage As Visio.Page

> > >Private Sub actPage_CellChanged(ByVal Cell As IVCell)
> > >    Dim val As String
> > >        val = "hexagon"
> > >        if val = Cell.shape then
> > >            cell.shape="square"
> > >        end if

> > >End Sub

> > >Private Sub Document_DocumentOpened(ByVal doc As
> > Visio.IVDocument)

> > >    Set actPage = Visio.ActivePage

> > >End Sub

> > >.



Wed, 03 Aug 2005 00:22:24 GMT  
 Changing shapes in VBA Code
If you want to change a shape based on what  you type, I think you can use
two methods.
    case 1: you use VBA or VB since you got Graham's book
        create a place to store the type; User.ShapeType = "Rectangle"
        create a trigger; User.RunFunction =
"runaddonwithargs('MyProgram',cmd="ChangeShape")

    case 2: you use only the shape sheet.
        create all the shapes you need, circle, square, rectangle, hexagon -
excetra.
        set each shapes name to its type "Circle", "Square", etc.
        then group them as one group - place them all ontop first so they
are at the same point
        in the parent group create a place to store the type; User.ShapeType
= "Circle"
        in each shape on the geometry1.noshow =
not(strsame(upper(name(0)),upper(parentshape.id!user.type))) where
parentshape.id = sheet.xxx of the parent
        if the shape name is not "circle" it will not appear
        You could create is all in one shape with a different geometry
section for each shape, but change name(0) to "circle", or "square",
depending on the section.


Quote:
> Graham:

> What I'm trying to do is on change of a cell I want to change the shape to
> what ever I put in the cell. so if the shape is a Hexagon then one of the
> custom property has it shape in it, so when I change it to Square I want
the
> shape to change to a square. So from what I have been able to read from
your
> book I got yesterday, it looks like I need to create a new shape copy the
> information over and then delete the shape.

> I think I may be on the right track now, but any input is greatly
appreciate

> Jim


message

> > Jim:

> > What exactly do you want to have happen here?  For example, do you want
> some
> > VBA to change the geometry of the existing shape? Or do you want some
VBA
> to
> > delete that shape and replace it with another?

> > At any rate, a number of the statements in your sample code don't seem
to
> be
> > doing sensible things, for example:

> >   cell.shape="square"

> > so perhaps you might be helped out quite a bit by the Developing Visio
> > Solutions book that is completely available through the
msdn.microsoft.com
> > library:

> > msdn.microsoft.com/library/en-us/devref/HTML/DVS_00_Preface_540.asp?

> > Graham

> > --
> > -----------------------------------------
> > Graham Wideman
> > Visio 2002 Developer's Survival Pack
> > diagramantics.com


> > > so can someone help me with this or is this something that
> > > you have not tried to do?

> > > Thanks
> > > Jim

> > > >-----Original Message-----
> > > >i am using this function to find any changes on the
> > > current page in Visio
> > > >and i have a custom field thats has a shape type in it.
> > > so if some one where
> > > >to change it from Hexagon to Square, i want the shape to
> > > chane to what they
> > > >typed in.

> > > >this is what i have done so far:

> > > >Private WithEvents actPage As Visio.Page

> > > >Private Sub actPage_CellChanged(ByVal Cell As IVCell)
> > > >    Dim val As String
> > > >        val = "hexagon"
> > > >        if val = Cell.shape then
> > > >            cell.shape="square"
> > > >        end if

> > > >End Sub

> > > >Private Sub Document_DocumentOpened(ByVal doc As
> > > Visio.IVDocument)

> > > >    Set actPage = Visio.ActivePage

> > > >End Sub

> > > >.



Wed, 03 Aug 2005 01:28:43 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. dynamically change shapes and colors with VBA

2. Changing a shapes color from VBA

3. Change Colors of Shapes in VBA

4. Change grouped shape color through VBA?

5. Change Shape's Line Color through VBA

6. VBA Code to add text to shapes in Excel

7. Shape color change problem (with code sample)

8. Changing the anchor point of a shape in code

9. Dropping shapes through VBA with shape Custom Properties setting ASK =True

10. How to change a report Grouping through VBA code

11. Changing macro actions using DAO/VBA code

12. Vba Code to Change Autonumber field

 

 
Powered by phpBB® Forum Software