Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Visio

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-01-2008, 01:26 PM
=?Utf-8?B?SXZhbiBTYWxhcw==?=
 
Posts: n/a
Record Macros- Resizing shapes

Hello all,

I am trying to record a macro by doing the following:

- Start Macro
- View Menu- Size & Position window
- Afterwards, I input the desired width and height.
- Stop Macro

All is well, but afterwards, when I select Run Macro, only the shape from
which I created the Macro changes. I want to be able to create a macro that
will resize ANY shape on the diagram, not only that one.

I would also like to be able to resize many shapes at the same time using
this macro. Is this possible?

Thanks,
Ivan



Reply With Quote
  #2 (permalink)  
Old 07-01-2008, 02:18 PM
=?Utf-8?B?UGhpbGlwcGUgQy4=?=
 
Posts: n/a
RE: Record Macros- Resizing shapes

You can do both in one go.
Adapt your macro so that it works with each shape in the Selection.

......
for each shp in ...

next shp

"Ivan Salas" wrote:

> Hello all,
>
> I am trying to record a macro by doing the following:
>
> - Start Macro
> - View Menu- Size & Position window
> - Afterwards, I input the desired width and height.
> - Stop Macro
>
> All is well, but afterwards, when I select Run Macro, only the shape from
> which I created the Macro changes. I want to be able to create a macro that
> will resize ANY shape on the diagram, not only that one.
>
> I would also like to be able to resize many shapes at the same time using
> this macro. Is this possible?
>
> Thanks,
> Ivan
>
>
>

Reply With Quote
  #3 (permalink)  
Old 07-01-2008, 03:52 PM
John... Visio MVP
 
Posts: n/a
Re: Record Macros- Resizing shapes

"Ivan Salas" <IvanSalas@discussions.microsoft.com> wrote in message
news:58C614BF-40F0-450B-BC10-A80C15536252@microsoft.com...
> Hello all,
>
> I am trying to record a macro by doing the following:
>
> - Start Macro
> - View Menu- Size & Position window
> - Afterwards, I input the desired width and height.
> - Stop Macro
>
> All is well, but afterwards, when I select Run Macro, only the shape from
> which I created the Macro changes. I want to be able to create a macro
> that
> will resize ANY shape on the diagram, not only that one.
>
> I would also like to be able to resize many shapes at the same time using
> this macro. Is this possible?
>
> Thanks,
> Ivan



Record Macro is limited. It will record EXACTLY what ou do and when you play
it back it will do it EXACTLY the same. You need to modify the macro to
handle a more generic case.

The big plus for Record Macro is that it shows you what commands you will
need.

In your case, you will need to replace the reference to the selection. You
original macro should look like
Dim UndoScopeID3 As Long
UndoScopeID3 = Application.BeginUndoScope("Size & Position 2-D")
Application.ActiveWindow.Page.Shapes.ItemFromID(1) .CellsSRC(visSectionObject,
visRowXFormOut, visXFormWidth).FormulaU = "55 mm"
Application.EndUndoScope UndoScopeID3, True

Dim UndoScopeID4 As Long
UndoScopeID4 = Application.BeginUndoScope("Size & Position 2-D")
Application.ActiveWindow.Page.Shapes.ItemFromID(1) .CellsSRC(visSectionObject,
visRowXFormOut, visXFormHeight).FormulaU = "12 mm"
Application.EndUndoScope UndoScopeID4, True

Step 1. Lose the UNDOs

Application.ActiveWindow.Page.Shapes.ItemFromID(1) .CellsSRC(visSectionObject,
visRowXFormOut, visXFormWidth).FormulaU = "55 mm"
Application.ActiveWindow.Page.Shapes.ItemFromID(1) .CellsSRC(visSectionObject,
visRowXFormOut, visXFormHeight).FormulaU = "12 mm"

Step 2: Replace the target

Replace Application.ActiveWindow.Page.Shapes.ItemFromID with
ActiveWindow.Selection

You will end up with
If ActiveWindow.Selection.Count > 0 Then
ActiveWindow.Selection(1).CellsSRC(visSectionObjec t, visRowXFormOut,
visXFormWidth).FormulaU = "55 mm"
ActiveWindow.Selection(1).CellsSRC(visSectionObjec t, visRowXFormOut,
visXFormHeight).FormulaU = "12 mm"
End If

The "If ActiveWindow.Selection.Count > 0 Then" is to prevent the macro
running if nothing is selcted. You can add an Else setion to provide a
warning.

John... Visio MVP

Reply With Quote
  #4 (permalink)  
Old 07-01-2008, 07:46 PM
=?Utf-8?B?UGhpbGlwcGUgQy4=?=
 
Posts: n/a
RE: Record Macros- Resizing shapes

Are you sure you want to do it with a macro ?
If all the selected shapes are 2D, then you can change width and height in
the Size and Position window.
Ctrl + A selects all the shapes on a page.

"Ivan Salas" wrote:

> Hello all,
>
> I am trying to record a macro by doing the following:
>
> - Start Macro
> - View Menu- Size & Position window
> - Afterwards, I input the desired width and height.
> - Stop Macro
>
> All is well, but afterwards, when I select Run Macro, only the shape from
> which I created the Macro changes. I want to be able to create a macro that
> will resize ANY shape on the diagram, not only that one.
>
> I would also like to be able to resize many shapes at the same time using
> this macro. Is this possible?
>
> Thanks,
> Ivan
>
>
>

Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Visio


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:09 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109