WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Record Macros- Resizing shapes

 
   Home -> Office other -> General Discussions RSS
Next:  General Discussions: Need a visio template for Windows XP User Interface  
Author Message
Ivan Salas

External


Since: Jun 20, 2008
Posts: 6



(Msg. 1) Posted: Tue Jul 01, 2008 6:26 am
Post subject: Record Macros- Resizing shapes Add to elertz
Archived from groups: microsoft>public>visio (more info?)

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
Back to top
Login to vote
Philippe C.

External


Since: Jul 06, 2007
Posts: 238



(Msg. 2) Posted: Tue Jul 01, 2008 7:18 am
Post subject: RE: Record Macros- Resizing shapes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
>
>
>
Back to top
Login to vote
John... Visio MVP

External


Since: Jun 23, 2008
Posts: 103



(Msg. 3) Posted: Tue Jul 01, 2008 11:52 am
Post subject: Re: Record Macros- Resizing shapes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Ivan Salas" <IvanSalas.DeleteThis@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(visSectionObject, visRowXFormOut,
visXFormWidth).FormulaU = "55 mm"
ActiveWindow.Selection(1).CellsSRC(visSectionObject, 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
Back to top
Login to vote
Philippe C.

External


Since: Jul 06, 2007
Posts: 238



(Msg. 4) Posted: Tue Jul 01, 2008 12:46 pm
Post subject: RE: Record Macros- Resizing shapes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
>
>
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> General Discussions All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET