Is there a quick way to make the same change to multiple ShapeSheets?

Started by haggis999, May 24, 2013, 06:49:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

haggis999

I am just starting to learn how to use the trial version of Visio 2013 and this is my very first post to this forum.

I have imported a complex back panel diagram for an AV amplifier as an SVG from Adobe Illustrator and I want this diagram to be fully resizable. A search online for a method of making text resizable in Visio found a solution from Visio Guy, which was to change a fixed character size in a text box ShapeSheet to the following formula:

=12 pt*ThePage!PageScale/ThePage!DrawingScale*Height/0.23

The use of 12 pt in that formula is obviously just an example. The figure of 0.23 is a figure found by trial and error that generated the same size text as before in one sample text box (before any resizing of that box).

My problem is that my diagram has a very large number of similar text boxes and changing the ShapeSheets one at a time would be extremely tedious. Is there a better way?

David

EDIT:  I suspect the answer to my own question is to write some VBA code that creates a list of all the text boxes on a page and then runs a loop to modify the Character value for each text box in turn. It still seems a little odd to me that Visio doesn't simply let you select multiple text boxes and then apply the same change to all of them simultaneously, which is the way that a lot of other software behaves.

Assuming that VBA code would solve my problem, I guess this question should really be in the Programming & Code forum.

JuneTheSecond

I am very bad in English.
So. I read only the title of your question.
The content is too long for me to read.
Therefore my answer may be wrong.

You can save your Visio document in the form of XML.
Then you can open saved XML file with text editor or XML editor.
And then you can edit multiple shapesheet with change or replace command in the text editor.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

haggis999

How do I save in XML format?

I am using Visio 2013. I cannot see any XML option.

David

NOTE: Google Translate can be useful if you find English difficult to understand.
http://translate.google.com/


haggis999

After some searching, I found out that if I changed the .vsdx filename extension to .zip I could then view the XML contents using software called EditPad Pro 7 (I don't know where that came from) or in Visual Studio 2012.

While inspecting the XML code, it seemed that making selective font size changes would be very difficult. I could not see how I could find only the font size settings for a specific set of textboxes on a complex Visio page. I therefore went back to Visio and moved the relevant items to a separate page. I also made sure that all my existing textboxes had exactly the same font size.

I then did a search and replace on the XML file as follows (the new text was based on the result of one of my previous manual changes):

ORIGINAL TEXT:    <Cell N='Size' V='0.05555555555555555' U='PT'/>

REPLACED TEXT:   <Cell N='Size' V='0.04134486114774413' U='PT' F='5PT*ThePage!PageScale/ThePage!DrawingScale*Height/0.177'/>

I then saved this XML file, renamed my .zip back to .vsdx and reopened it in Visio. Unfortunately, none of my textboxes on the affected page had been updated to use my formula! I will try again tomorrow...

David

Visio Guy

I think that I can understand why they never tried to make a multi-applicable ShapeSheet. The context can be too different, and each selected shape can have so many different or unique cells, that it would be tricky or slow to make a common-cells ShapeSheet view. Not to mention how confusing it could be for users.

If you're doing this a lot, just have a blank "Tools" stencil or drawing that you can open, and run 'scratch' VBA code like this:


'// Set the ShapeSheet formula for each selected cell. Note, all
'// selected shapes must actually have the cells!

Dim shp as Visio.Shape
For Each shp in Visio.ActiveWindow.Selection

     '// Add cell and formula/results here:
     shp.Cells("Prop.Size").ResultIU = 2 '//...IU = inches
     shp.Cells("Prop.CommieSize").Result("mm") = 2 * 25.4
     shp.Cells("Prop.Name").FormulaU = Chr(34) & "Bob" & Chr(34)
     shp.CellsU("Width").FormulaForceU = "GUARD(Width * 2)" '//...'Force' to override preexisting GUARDs

Next shp
Set shp = Nothing
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

haggis999

Quote from: Visio Guy on May 28, 2013, 08:20:59 AM

If you're doing this a lot, just have a blank "Tools" stencil or drawing that you can open, and run 'scratch' VBA code ...


Hi VG,
Thanks for that; I had a feeling that VBA would provide the answer. However, I'm too much of a Visio newbie to fully understand what you mean by the above quote from your post. How would code stored somewhere in a 'Tools' drawing be invoked by my primary drawing?

I have some experience of using VBA in the event-driven environment of an Access database but don't yet understand what is normally used to trigger code in Visio (though I have found a familiar button control). Some clarification would be appreciated.

David

Yacine

Quote from: Visio Guy on May 28, 2013, 08:20:59 AM
I think that I can understand why they never tried to make a multi-applicable ShapeSheet. The context can be too different, and each selected shape can have so many different or unique cells, that it would be tricky or slow to make a common-cells ShapeSheet view. Not to mention how confusing it could be for users.
I don't want to agree with your statement. I prefer to still dream of a docking window that displays 1 to 1 the shapesheet. May be a little bit simplier ... not really. But available directly. Basically a better graphical Excel. May be a project for the next 2-3 weeks of vacation without kids? (I'm horrible, I know.)
Yacine

kennyj

Quote from: Yacine on May 28, 2013, 07:03:09 PM
I don't want to agree with your statement. I prefer to still dream of a docking window that displays 1 to 1 the shapesheet. May be a little bit simplier ... not really. But available directly. Basically a better graphical Excel. May be a project for the next 2-3 weeks of vacation without kids? (I'm horrible, I know.)

@Yacine - I'm a little wet behind the ears to know if you're comment is strictly "tongue in cheek" or not, but I'd be curious to hear more about what you're idea is all about. The thought reminds me a bit of some of my recent musings re: an excel template that mirrors the shapesheet and an accompanying macro to thus import shapes or changes to shapes, etc; along with my current prototyping project where I'm using excel to calculate various aspects of drawing requirements and then visio to draw them. Anyway, I'd be interested to hear about your ideas, if you care to share further on that topic.


kennyj

Quote from: haggis999 on May 28, 2013, 08:54:36 AM
Quote from: Visio Guy on May 28, 2013, 08:20:59 AM

If you're doing this a lot, just have a blank "Tools" stencil or drawing that you can open, and run 'scratch' VBA code ...


Hi VG,
Thanks for that; I had a feeling that VBA would provide the answer. However, I'm too much of a Visio newbie to fully understand what you mean by the above quote from your post. How would code stored somewhere in a 'Tools' drawing be invoked by my primary drawing?

I have some experience of using VBA in the event-driven environment of an Access database but don't yet understand what is normally used to trigger code in Visio (though I have found a familiar button control). Some clarification would be appreciated.

David

@David, I could be off base here, as I'm newer to VBA than you, but I've used visio off and on since pre-microsoft, so hopefully this coment will be relevant (and hopefully visguy or someone will correct me if I'm out to lunch!)

I think what VG was implying is that VBA code in visio generally lives either in a document or a stencil. So if you have some code that you want to reuse, you would need to have open the stencil or drawing it's attached to.

Therefore, creating a stencil for yourself in which to save your bits of frequently needed code, and then perhaps saving your workspace/template with that stencil open would allow easy access to the code whenever you should need it.

As to accessing the code from there, I would guess you can use a button control tied to the macro, or you could create a simple shape to store in your stencil, and set the double click action or such to run the associated macro, then just drag the shape off the stencil and double click on it when you want it. Here's a good little video from VG, which incidentally demonstrates  that very technique. Note also how he makes the 'button' shape non-printing so you can leave it out and not worry about forgetfully goofing up a printout with it showing.

Of course, you could alternately access the code manually via the macro menu, which I'm sure you're well aware of.

HTH,

-k

Yacine

@Kenny,
Quote@Yacine - I'm a little wet behind the ears to know if you're comment is strictly "tongue in cheek" or not, but I'd be curious to hear more about what you're idea is all about. The thought reminds me a bit of some of my recent musings re: an excel template that mirrors the shapesheet and an accompanying macro to thus import shapes or changes to shapes, etc; along with my current prototyping project where I'm using excel to calculate various aspects of drawing requirements and then visio to draw them. Anyway, I'd be interested to hear about your ideas, if you care to share further on that topic.
Well, I'm quite serious about it.
Whilst most (developers) would prefer to hide the shapesheet from the normal users, every developer would wish to have:
- a direct access to the shapesheet without having to switch between the windows
- an editing feature for multiple shapes
- a possibilty to edit the shapesheet from outer editors (eg Excel)  ,....

As I  sayed, it is a project for which one needs some days of a calm period and we shall get remembered about it. May be the rating feature that Chris will implement ( ;D http://visguy.com/vgforum/index.php?topic=4845.msg19051;topicseen#msg19051), will help us in this matter.

I'd love to follow your project, but not right now, as I've already too much projects to handle. hopefully somewhen in summer this year.
This would definitely be the ULTIMATE contribution to Visio from it's community.
Yacine

kennyj

Very interesting, @Yacine. It will be fun to see what develops :)
Thanks,

-k

kennyj


Yacine

Yacine

haggis999

Kennyj,
I've not had much time to play with Visio over the past week but I will follow up your suggestions asap. Thanks for the help.

Yacine,
If you can come up with ways to edit multiple ShapeSheets simultaneously then that would certainly fill a gap in the standard product. I'm sure your kids will understand the need to lock them up while you get on with such important work  :)

David