想实现的功能是1.将选择的文字转换成图片,2.剪掉空白处3.选中 目前第2点无法实现 , 老大或高手经过帮下忙, 万分感谢! Sub 文字转图形() On Error Resume Next Dim pLeft As Long Dim pTop As Long Dim pWidth As Long Dim pHeight As Long Dim cd1, cd2 ActiveDocument.ActiveWindow.GetPoint pLeft, pTop, pWidth, pHeight, Selection.Range '以厘米为单位返回所选内容的宽度 cd1 = Word.PixelsToPoints(Word.PixelsToPoints(pWidth)) cd2 = 380 - Val(cd1) '转图形 With Selection .CopyAsPicture '.Collapse Direction:=wdCollapseEnd .PasteSpecial DataType:=wdPasteMetafilePicture End With ActiveDocument.Range(0, 0).Select Selection.Copy CommandBars("Clipboard").Controls(4).Execute '选中 ActiveDocument.Shapes(ActiveDocument.Shapes.Count).Select '剪切 Selection.ShapeRange.PictureFormat.Brightness = 0.5 Selection.ShapeRange.PictureFormat.Contrast = 0.5 Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic Selection.ShapeRange.PictureFormat.CropLeft = 0# Selection.ShapeRange.PictureFormat.CropRight = cd2 Selection.ShapeRange.PictureFormat.CropTop = 0# Selection.ShapeRange.PictureFormat.CropBottom = 0# '选中 ActiveDocument.Shapes(ActiveDocument.Shapes.Count).Select End Sub
[此贴子已经被作者于2007-5-21 11:27:23编辑过] |