|
普通にシェイプのAutoShapeTypeを取得すると数値になりますので
Dictionaryを使ってAutoShapeTypeを文字列に変換しました。
アクティブシートの全シェイプの名前、種類、Left、Top、Width、Height
を取得するサンプルです。
回転させているシェイプの回転角度や調整ハンドルでの調整値の取得方法
は分かりません。
新規シートにシェイプの適当に配置してお試し下さい。
Sub test()
Dim spdic As Object
Dim sp As Object
Dim cnt As Integer
Set spdic = CreateObject("Scripting.Dictionary")
spdic.Add msoShapeMixed, "msoShapeMixed"
spdic.Add msoShapeRectangle, "msoShapeRectangle"
spdic.Add msoShapeParallelogram, "msoShapeParallelogram"
spdic.Add msoShapeTrapezoid, "msoShapeTrapezoid"
spdic.Add msoShapeDiamond, "msoShapeDiamond"
spdic.Add msoShapeRoundedRectangle, "msoShapeRoundedRectangle"
spdic.Add msoShapeOctagon, "msoShapeOctagon"
spdic.Add msoShapeIsoscelesTriangle, "msoShapeIsoscelesTriangle"
spdic.Add msoShapeRightTriangle, "msoShapeRightTriangle"
spdic.Add msoShapeOval, "msoShapeOval"
spdic.Add msoShapeHexagon, "msoShapeHexagon"
spdic.Add msoShapeCross, "msoShapeCross"
spdic.Add msoShapeRegularPentagon, "msoShapeRegularPentagon"
spdic.Add msoShapeCan, "msoShapeCan"
spdic.Add msoShapeCube, "msoShapeCube"
spdic.Add msoShapeBevel, "msoShapeBevel"
spdic.Add msoShapeFoldedCorner, "msoShapeFoldedCorner"
spdic.Add msoShapeSmileyFace, "msoShapeSmileyFace"
spdic.Add msoShapeDonut, "msoShapeDonut"
spdic.Add msoShapeNoSymbol, "msoShapeNoSymbol"
spdic.Add msoShapeBlockArc, "msoShapeBlockArc"
spdic.Add msoShapeHeart, "msoShapeHeart"
spdic.Add msoShapeLightningBolt, "msoShapeLightningBolt"
spdic.Add msoShapeSun, "msoShapeSun"
spdic.Add msoShapeMoon, "msoShapeMoon"
spdic.Add msoShapeArc, "msoShapeArc"
spdic.Add msoShapeDoubleBracket, "msoShapeDoubleBracket"
spdic.Add msoShapeDoubleBrace, "msoShapeDoubleBrace"
spdic.Add msoShapePlaque, "msoShapePlaque"
spdic.Add msoShapeLeftBracket, "msoShapeLeftBracket"
spdic.Add msoShapeRightBracket, "msoShapeRightBracket"
spdic.Add msoShapeLeftBrace, "msoShapeLeftBrace"
spdic.Add msoShapeRightBrace, "msoShapeRightBrace"
spdic.Add msoShapeRightArrow, "msoShapeRightArrow"
spdic.Add msoShapeLeftArrow, "msoShapeLeftArrow"
spdic.Add msoShapeUpArrow, "msoShapeUpArrow"
spdic.Add msoShapeDownArrow, "msoShapeDownArrow"
spdic.Add msoShapeLeftRightArrow, "msoShapeLeftRightArrow"
spdic.Add msoShapeUpDownArrow, "msoShapeUpDownArrow"
spdic.Add msoShapeQuadArrow, "msoShapeQuadArrow"
spdic.Add msoShapeLeftRightUpArrow, "msoShapeLeftRightUpArrow"
spdic.Add msoShapeBentArrow, "msoShapeBentArrow"
spdic.Add msoShapeUTurnArrow, "msoShapeUTurnArrow"
spdic.Add msoShapeLeftUpArrow, "msoShapeLeftUpArrow"
spdic.Add msoShapeBentUpArrow, "msoShapeBentUpArrow"
spdic.Add msoShapeCurvedRightArrow, "msoShapeCurvedRightArrow"
spdic.Add msoShapeCurvedLeftArrow, "msoShapeCurvedLeftArrow"
spdic.Add msoShapeCurvedUpArrow, "msoShapeCurvedUpArrow"
spdic.Add msoShapeCurvedDownArrow, "msoShapeCurvedDownArrow"
spdic.Add msoShapeStripedRightArrow, "msoShapeStripedRightArrow"
spdic.Add msoShapeNotchedRightArrow, "msoShapeNotchedRightArrow"
spdic.Add msoShapePentagon, "msoShapePentagon"
spdic.Add msoShapeChevron, "msoShapeChevron"
spdic.Add msoShapeRightArrowCallout, "msoShapeRightArrowCallout"
spdic.Add msoShapeLeftArrowCallout, "msoShapeLeftArrowCallout"
spdic.Add msoShapeUpArrowCallout, "msoShapeUpArrowCallout"
spdic.Add msoShapeDownArrowCallout, "msoShapeDownArrowCallout"
spdic.Add msoShapeLeftRightArrowCallout, "msoShapeLeftRightArrowCallout"
spdic.Add msoShapeUpDownArrowCallout, "msoShapeUpDownArrowCallout"
spdic.Add msoShapeQuadArrowCallout, "msoShapeQuadArrowCallout"
spdic.Add msoShapeCircularArrow, "msoShapeCircularArrow"
spdic.Add msoShapeFlowchartProcess, "msoShapeFlowchartProcess"
spdic.Add msoShapeFlowchartAlternateProcess, "msoShapeFlowchartAlternateProcess"
spdic.Add msoShapeFlowchartDecision, "msoShapeFlowchartDecision"
spdic.Add msoShapeFlowchartData, "msoShapeFlowchartData"
spdic.Add msoShapeFlowchartPredefinedProcess, "msoShapeFlowchartPredefinedProcess"
spdic.Add msoShapeFlowchartInternalStorage, "msoShapeFlowchartInternalStorage"
spdic.Add msoShapeFlowchartDocument, "msoShapeFlowchartDocument"
spdic.Add msoShapeFlowchartMultidocument, "msoShapeFlowchartMultidocument"
spdic.Add msoShapeFlowchartTerminator, "msoShapeFlowchartTerminator"
spdic.Add msoShapeFlowchartPreparation, "msoShapeFlowchartPreparation"
spdic.Add msoShapeFlowchartManualInput, "msoShapeFlowchartManualInput"
spdic.Add msoShapeFlowchartManualOperation, "msoShapeFlowchartManualOperation"
spdic.Add msoShapeFlowchartConnector, "msoShapeFlowchartConnector"
spdic.Add msoShapeFlowchartOffpageConnector, "msoShapeFlowchartOffpageConnector"
spdic.Add msoShapeFlowchartCard, "msoShapeFlowchartCard"
spdic.Add msoShapeFlowchartPunchedTape, "msoShapeFlowchartPunchedTape"
spdic.Add msoShapeFlowchartSummingJunction, "msoShapeFlowchartSummingJunction"
spdic.Add msoShapeFlowchartOr, "msoShapeFlowchartOr"
spdic.Add msoShapeFlowchartCollate, "msoShapeFlowchartCollate"
spdic.Add msoShapeFlowchartSort, "msoShapeFlowchartSort"
spdic.Add msoShapeFlowchartExtract, "msoShapeFlowchartExtract"
spdic.Add msoShapeFlowchartMerge, "msoShapeFlowchartMerge"
spdic.Add msoShapeFlowchartStoredData, "msoShapeFlowchartStoredData"
spdic.Add msoShapeFlowchartDelay, "msoShapeFlowchartDelay"
spdic.Add msoShapeFlowchartSequentialAccessStorage, "msoShapeFlowchartSequentialAccessStorage"
spdic.Add msoShapeFlowchartMagneticDisk, "msoShapeFlowchartMagneticDisk"
spdic.Add msoShapeFlowchartDirectAccessStorage, "msoShapeFlowchartDirectAccessStorage"
spdic.Add msoShapeFlowchartDisplay, "msoShapeFlowchartDisplay"
spdic.Add msoShapeExplosion1, "msoShapeExplosion1"
spdic.Add msoShapeExplosion2, "msoShapeExplosion2"
spdic.Add msoShape4pointStar, "msoShape4pointStar"
spdic.Add msoShape5pointStar, "msoShape5pointStar"
spdic.Add msoShape8pointStar, "msoShape8pointStar"
spdic.Add msoShape16pointStar, "msoShape16pointStar"
spdic.Add msoShape24pointStar, "msoShape24pointStar"
spdic.Add msoShape32pointStar, "msoShape32pointStar"
spdic.Add msoShapeUpRibbon, "msoShapeUpRibbon"
spdic.Add msoShapeDownRibbon, "msoShapeDownRibbon"
spdic.Add msoShapeCurvedUpRibbon, "msoShapeCurvedUpRibbon"
spdic.Add msoShapeCurvedDownRibbon, "msoShapeCurvedDownRibbon"
spdic.Add msoShapeVerticalScroll, "msoShapeVerticalScroll"
spdic.Add msoShapeHorizontalScroll, "msoShapeHorizontalScroll"
spdic.Add msoShapeWave, "msoShapeWave"
spdic.Add msoShapeDoubleWave, "msoShapeDoubleWave"
spdic.Add msoShapeRectangularCallout, "msoShapeRectangularCallout"
spdic.Add msoShapeRoundedRectangularCallout, "msoShapeRoundedRectangularCallout"
spdic.Add msoShapeOvalCallout, "msoShapeOvalCallout"
spdic.Add msoShapeCloudCallout, "msoShapeCloudCallout"
spdic.Add msoShapeLineCallout1, "msoShapeLineCallout1"
spdic.Add msoShapeLineCallout2, "msoShapeLineCallout2"
spdic.Add msoShapeLineCallout3, "msoShapeLineCallout3"
spdic.Add msoShapeLineCallout4, "msoShapeLineCallout4"
spdic.Add msoShapeLineCallout1AccentBar, "msoShapeLineCallout1AccentBar"
spdic.Add msoShapeLineCallout2AccentBar, "msoShapeLineCallout2AccentBar"
spdic.Add msoShapeLineCallout3AccentBar, "msoShapeLineCallout3AccentBar"
spdic.Add msoShapeLineCallout4AccentBar, "msoShapeLineCallout4AccentBar"
spdic.Add msoShapeLineCallout1NoBorder, "msoShapeLineCallout1NoBorder"
spdic.Add msoShapeLineCallout2NoBorder, "msoShapeLineCallout2NoBorder"
spdic.Add msoShapeLineCallout3NoBorder, "msoShapeLineCallout3NoBorder"
spdic.Add msoShapeLineCallout4NoBorder, "msoShapeLineCallout4NoBorder"
spdic.Add msoShapeLineCallout1BorderandAccentBar, "msoShapeLineCallout1BorderandAccentBar"
spdic.Add msoShapeLineCallout2BorderandAccentBar, "msoShapeLineCallout2BorderandAccentBar"
spdic.Add msoShapeLineCallout3BorderandAccentBar, "msoShapeLineCallout3BorderandAccentBar"
spdic.Add msoShapeLineCallout4BorderandAccentBar, "msoShapeLineCallout4BorderandAccentBar"
spdic.Add msoShapeActionButtonCustom, "msoShapeActionButtonCustom"
spdic.Add msoShapeActionButtonHome, "msoShapeActionButtonHome"
spdic.Add msoShapeActionButtonHelp, "msoShapeActionButtonHelp"
spdic.Add msoShapeActionButtonInformation, "msoShapeActionButtonInformation"
spdic.Add msoShapeActionButtonBackorPrevious, "msoShapeActionButtonBackorPrevious"
spdic.Add msoShapeActionButtonForwardorNext, "msoShapeActionButtonForwardorNext"
spdic.Add msoShapeActionButtonBeginning, "msoShapeActionButtonBeginning"
spdic.Add msoShapeActionButtonEnd, "msoShapeActionButtonEnd"
spdic.Add msoShapeActionButtonReturn, "msoShapeActionButtonReturn"
spdic.Add msoShapeActionButtonDocument, "msoShapeActionButtonDocument"
spdic.Add msoShapeActionButtonSound, "msoShapeActionButtonSound"
spdic.Add msoShapeActionButtonMovie, "msoShapeActionButtonMovie"
spdic.Add msoShapeBalloon, "msoShapeBalloon"
spdic.Add msoShapeNotPrimitive, "msoShapeNotPrimitive"
cnt = 1
ActiveSheet.Cells(1, 1).Value = "名前"
ActiveSheet.Cells(1, 2).Value = "種類"
ActiveSheet.Cells(1, 3).Value = "Left"
ActiveSheet.Cells(1, 4).Value = "Top"
ActiveSheet.Cells(1, 5).Value = "Width"
ActiveSheet.Cells(1, 6).Value = "Height"
For Each sp In ActiveSheet.DrawingObjects
cnt = cnt + 1
With ActiveSheet.Cells(cnt, 1)
.Value = sp.Name
.Offset(, 1).Value = spdic(ActiveSheet.Shapes(sp.Name).AutoShapeType)
.Offset(, 2).Value = sp.Left
.Offset(, 3).Value = sp.Top
.Offset(, 4).Value = sp.Width
.Offset(, 5).Value = sp.Height
End With
Next sp
spdic.RemoveAll
Set spdic = Nothing
End Sub
|
|