### Author Topic: Code / Formula to represent a Group [resizing text]  (Read 38730 times)

0 Members and 1 Guest are viewing this topic.

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #45 on: June 02, 2010, 10:34:31 AM »
@Jumpy

Have a bless extended holiday weekend....

Again, thank you so, so much for all your help.

Brandy

#### Jumpy

• Hero Member
• Posts: 1061
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #46 on: June 07, 2010, 03:53:25 AM »
Hello,
here is the promised version that changes the formula in the Tabs Section, too.
But it is still not perfect. The shape can now shrink more before the text gets disrupted, but at a certain point it will get disrupted, no matter what.
Maybe the formula has to be more complex, taking into account the different fonts itself, the number of characters before and after a tab and and and...
The only benefit is that the shapes now look better than before, when they get bigger. Thats because they always look the same now, thanks to the although growing Tab.

Code
``Dim strFormula As StringDim SubShape As Visio.ShapeDim i, j As IntegerOn Error Resume Next'Change the selected shapedouHeight = shp.Cells("Height").Result("MM")For i = 0 To shp.Section(3).Count - 1douCharSize = shp.Section(3).Row(i).Cell(7).Result("pt.")strFormula = "Height/" & douHeight & " mm *" & douCharSize & " pt."shp.Section(3).Row(i).Cell(7).Formula = strFormulaNext iFor j = 0 To shp.Section(5).Count - 1For i = 1 To shp.Section(5).Row(j).Count Step 3douTab = shp.Section(5).Row(j).Cell(i).Result("MM")strFormula = "Height/" & douHeight & " mm *" & douTab & " mm"shp.Section(5).Row(j).Cell(i).Formula = strFormulaNext iNext j'Change Sub Shapes by calling this function againFor Each SubShape In shp.ShapesChange_Formula SubShapeNextEnd SubSub Start()'As the name suggests, this Makro has to be startedDim shp As Visio.ShapeDim pg As Visio.PageFor Each pg In Application.ActiveDocument.Pages For Each shp In pg.Shapes  Change_Formula shp NextNextEnd Sub``

Thats the best I could come up with in my little spare time. Maybe it's enough.

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #47 on: June 07, 2010, 10:24:54 AM »
@Jumpy

You did a wonderful job.... Thank you, thank you, thank you....

You are a Godsend....

I hope your extended vacation was wonderful.

Again, thank you so much for all your hard work.

Brandy

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #48 on: June 07, 2010, 10:26:55 AM »
@Jumpy

VB does not like the "On Error Resume Next"

Complile Error:  Invalid outside procedure

Brandy

#### Jumpy

• Hero Member
• Posts: 1061
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #49 on: June 07, 2010, 03:24:18 PM »
Thats a standard VBA line to ignore all errors. If it weren't in the code you would get multiple error messages when looping through the sections, rows and cells, whenever a section, row, cell doesn't exist. Therefore it's necessary and I can't see, why it shouldn't work.

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #50 on: June 07, 2010, 05:18:26 PM »
This is what happens when I run the new one.

Thanks

Brandy

#### JuneTheSecond

• Hero Member
• Posts: 1027
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #51 on: June 07, 2010, 05:25:09 PM »
Sub Change_Formula(shp As Visio.shape)
Best Regards,

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

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #52 on: June 07, 2010, 05:46:24 PM »
OK, thanks

I will keep you posted

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #53 on: June 07, 2010, 05:54:20 PM »
@Jumpy

You are one of the best...

Thank you, thank you, thank you so, so much....

Now I need to finish working on the Connectors...

Again, thank you

Brandy

#### Jumpy

• Hero Member
• Posts: 1061
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #54 on: June 08, 2010, 07:12:15 AM »
Oh sorry, I didn't see that. When I use copy+paste I shouldn't forget the first line.
Domo arigato, JuneTheSecond.

#### JuneTheSecond

• Hero Member
• Posts: 1027
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #55 on: June 08, 2010, 08:00:22 AM »
Don't mind. I often forget to copy not only first line but also last line.
Best Regards,

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

#### Brandy

• Full Member
• Posts: 91
##### Re: Code / Formula to represent a Group [resizing text]
« Reply #56 on: June 08, 2010, 10:05:25 AM »
Please....  you did a wonderful job....

Thank you....

Brandy