Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-05-2014, 12:41 PM
excelledsoftware excelledsoftware is offline VBA to change shape rotation Windows 7 64bit VBA to change shape rotation Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

You need to make some objects to achieve this. The Set word will do this after you dim it. The code below will do what you are looking for.
Code:
Sub Button1_Click()
  Dim ws As Worksheet, AngleShape(1 To 3) As Shape, x As Byte

    'Set up the references
    Set ws = ThisWorkbook.ActiveSheet
    Set AngleShape(1) = ws.Shapes("Ship")
    Set AngleShape(2) = ws.Shapes("Wind")
    Set AngleShape(3) = ws.Shapes("Apparent")
    
    'Perform the calculation
    Calculate
    'Perform the rotation for the above shapes
    For x = 1 To 3
      AngleShape(x).Rotation = ws.Cells(2, x)
    Next x

End Sub
I have a question for anybody though. My lines after 'Set the references show me setting each shape to the array variable. I tried things like
Code:
Set AngleShape = (ws.Shapes("Ship"), ws.Shapes("Wind"), ws.Shapes("Apparent"))
and
Code:
Set AngleShape = Array(ws.Shapes("Ship"), ws.Shapes("Wind"), ws.Shapes("Apparent"))
and
Code:
Set AngleShape() = Array(ws.Shapes("Ship"), ws.Shapes("Wind"), ws.Shapes("Apparent"))
But it will not let me do this. Even if I dim AngleShape as variant. I know that 2 more lines of code isnt a big deal but I would like to know if it is possible.

Thanks

Last edited by excelledsoftware; 09-05-2014 at 12:48 PM. Reason: forgot content
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to change shape rotation Change accent theme color used as shape fill (not RGBs) preetidb PowerPoint 4 12-30-2013 03:22 PM
color change for same shape ajkiran PowerPoint 1 11-10-2012 07:41 AM
VBA to change shape rotation enter free rotation excelledsoftware PowerPoint 3 03-01-2012 06:59 PM
VBA to change shape rotation Rotation Animation? shinyjellicent12321 PowerPoint 1 02-19-2012 11:43 AM
Motion Paths with Rotation PBone PowerPoint 4 01-13-2011 11:59 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft