i want to copy size (height & width) of selected object to microsoft excel
can some one give me the code for VBA
You can try code below:
Sub copyobjectdata()Dim sh As ShapeRange, w#, h#ActiveDocument.Unit = cdrMillimeterSet sh = ActiveSelectionRangeSet s = ActiveDocument.ActiveLayer.CreateParagraphText(1, 1, 0, 0, "")sh(1).GetSize w, hSet t = s.Textt.Story.InsertAfter(h & " , " & w).Copys.DeleteEnd Sub
Another code export information about objects on active page - object sequence on page, position x, position y, width, height - to file c:\corelobjects.txt
Sub objectdata()Dim sh As Shape, w#, h#, x#, y#, s As Shape, n#ActiveDocument.Unit = cdrMillimeterSet s = ActiveDocument.ActiveLayer.CreateParagraphText(1, 1, 0, 0, "pos|x|y|h|w" & vbCr)s.OrderToBackActiveDocument.ReferencePoint = cdrCenterFor Each sh In ActivePage.Shapessh.GetPosition x, ysh.GetSize w, hi = sh.ZOrderSet t = s.Textt.Story.InsertAfter (i & "|" & x & "|" & y & "|" & w & "|" & h & "|" & vbCr)Next shn = ActivePage.Shapes.Countt.ExportToFile "c:\corelobjects.txt", 1, n, cdrParagraphIndexings.DeleteEnd Sub
Hope this helps,
Best regards,
Mek