vba设置word图片格式
Dim blnIsInlineShape As Boolean
If Selection.Type = wdSelectionInlineShape Then
blnIsInlineShape = True
Selection.InlineShapes(1).ConvertToShape
End If
Dim intTurn As Integer
intTurn = InputBox("请输入图形要旋转的角度值" & vbCrLf & "正数表示顺时针,负数表示逆时针。", "图形旋转", 30)
Selection.ShapeRange.IncrementRotation intTurn
End Sub
二、将文档中的每张图片的版式转换为嵌入式图形
For Each s In Documents("MyDoc.doc").Shapes
If s.Type = msoPicture Then
s.ConvertToInlineShape
End If
Next s
三、设置图片的高度宽度
Mywidth=10'10为图片宽度(厘米)
Myheigth=10'10为图片高度(厘米)
For Each iShape In ActiveDocument.InlineShapes
iShape.Height = 28.345 * Myheigth
iShape.Width = 28.345 * Mywidth
Next iShape
四、得到图片的像素
Sub 获取嵌入型图片的像素()
On Error Resume Next
With Selection.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Execute findtext:="^g", MatchWildcards:=False, Wrap:=wdFindStop
MsgBox "该图片的像素为:" & Selection.InlineShapes(1).Width _
& " * " & Selection.InlineShapes(1).Height
End With
End Sub
五、复制图片到word文档中
Dim objWordApp As Word.Application
Dim objWord As Word.Document
Range(Cells(3, 2), Cells(11, 11)).Select
Selection.CopyPicture
Set objWordApp = CreateObject("Word.Application")
Set objWord = objWordApp.Documents.Add
objWord.Application.Visible = True
objWord.Application.Selection.Paste
Set objWord = Nothing
Set objWordApp = Nothing
不要在微信、知乎、QQ、内置浏览器下载、请用手机浏览器下载! 如果您是手机用户,请移步电脑端下载!
1、文稿PPT,仅供学习参考,请在下载后24小时删除。
2、如果资源涉及你的合法权益,第一时间删除。
3、联系方式:mail@johngko.com
第一素材网 » vba设置word图片格式