How to refer a cell in a visio shapesheet

Started by nilani, July 30, 2011, 10:52:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nilani

Hi,

Can any body please tell me how to refer a cell in a shapesheet using VBA. I want to refer a cell in a master.

A master
Masters[MasterName]!SheetName!CellReference                                     Masters[Gear]!Shaft!Geometry1.X1


This is what I found in SDK.  This is OK for Geometry because it can be referred as X.1,X.2...Y.1,Y.2..etc
But how to refer a cell in Shape Data Section??
Thank you

Paul Herber

The cells are referenced by Prop.<PropertyName>
e,g. ShapeName!Prop.Version
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

wapperdude

#2
You might want to check this out --- about midway down, there's a nice table showing how to reference various cells: 
http://msdn.microsoft.com/en-us/library/aa200961(v=office.10).aspx
Then, for automating, you might want to check out this and its related links:  http://msdn.microsoft.com/en-us/library/aa201763(v=office.10).aspx

HTH
Wapperdude
Visio 2019 Pro

nilani

#3
Hi,

Thank you very much for your reply. There is a option to record macro in VBA. So my question is can I record what I need to do in this,then go to code and understand? Will it be OK? Is there in difference in syntax? Please Don't laugh if this is a silly question :)

And there is another thing that I wanted to ask. I want to change cell values in shapesheet using a user form. This form should be open when a user drag and drop a master in to the drawing window and double click it?[I know to get it using RUNADDON]but the problem is I couldn't make it every time user drags and drop a master,to show the form.

wapperdude

Actually, reasonable question.  Yes, using the macro recorder is a good way to get some VBA understanding.  I don't remember the syntax off-hand, but, the macro recorder adds some "extra verbage" at the beginning which can be ignored or removed.

Wapperdude
Visio 2019 Pro

nilani

Thank you. I did a lot using record macro option :). Do you have any idea about my second question?

wapperdude

By 2nd question, you mean the issue of popping up a form to change values when a shape is dropped?

Visio already does that through what's called shape data.  Pick your shape, right click, select data, shapedata.  It will ask you to create new data.  On-line help should guide you through the process.  There's a check box to select to display data on drop.  The shapedata can be used to modify values of desired cells. 

No VBA coding necessary.
Visio 2019 Pro

nilani

Hi,

Quote from: wapperdude on August 01, 2011, 05:01:32 AM
By 2nd question, you mean the issue of popping up a form to change values when a shape is dropped?
Yes,But I want to run that user form and get some data from the user and insert them in to shapesheet? Not the shape data. I have attached a sample template that some other has done. I want to do some thing similar. Can you help me?