浏览代码

Create Selection_Export_JPEG.bas

蘭雅sRGB 3 年之前
父节点
当前提交
b377c106f8
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      Selection_Export_JPEG.bas

+ 18 - 0
Selection_Export_JPEG.bas

@@ -0,0 +1,18 @@
+' 实用小脚本:  选择遍历多个物件对象,按序号导出 JPEG
+ActiveDocument.Unit = cdrCentimeter
+Dim d As Document
+Set d = ActiveDocument
+cnt = 1
+Dim sh As Shape, shs As Shapes
+Set shs = ActiveSelection.Shapes
+
+For Each sh In shs
+    ActiveDocument.ClearSelection
+    sh.CreateSelection
+    MsgBox "选择物件尺寸: " & sh.SizeWidth & "x" & sh.SizeHeight
+    Size = Str(Int(sh.SizeWidth + 0.5)) + "x" + Str(Int(sh.SizeHeight + 0.5))
+    f = "R:\" + Str(cnt) + "_尺寸" + Size + ".jpg"
+    ' 可以把获得的尺寸取整数,写到文件名中,或者把尺寸信息写到图片中
+    d.Export f, cdrJPEG, cdrSelection
+    cnt = cnt + 1
+Next sh