⑴ 想在word頁面中,批量插入圖片,使得每頁有4張圖片均勻分布在頁面中,該怎麼做呢
這是統一設置word文檔中的圖片樣式,你的問題我不會,但是希望這個例子會對你有點提示。
使用宏:
一,在word中按alt+f11組合鍵,進入VBA模式
二,在左邊的工程資源管理器中找到你的word文檔,在其上右鍵/添加/模塊
三,把下面代碼復制,粘貼進去.
四,更改數值, 改一下寬度和高度數值(10),點運行(類似播放按鈕.)或f5,即可設置文檔中全部圖片
Sub Macro()
Mywidth=10'10為圖片寬度(厘米)
Myheigth=10'10為圖片高度(厘米)
For Each iShape In ActiveDocument.InlineShapes
iShape.Height = 28.345 * Myheigth
iShape.Width = 28.345 * Mywidth
Next iShape
End Sub
⑵ word打開時提示需要宏支持
准備材料:電腦、Word
1、單擊左下角的「開始」菜單,單擊「控制面板」
⑶ 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
⑷ word圖片格式
圖一是非嵌入型圖片,圖二是嵌入型圖片,簡單的說,你可以把嵌入型圖片理解成一個大文字,可以像文字一樣調整對齊、行距,甚至是自動編號。
那麼,以後如何讓插入的圖片是嵌入型圖片,我們需要點擊文件-選項-高級-剪切、復制和粘貼-將圖片插入、粘貼為:嵌入型
Sub 轉換圖片的版式()
Dim oShape As Variant, shapeType As WdWrapType
On Error Resume Next
If MsgBox("按「是」將圖片由嵌入式轉為浮動式 , 將「否」圖片由浮動式轉為嵌入式", 68) = 6 Then
shapeType = Val(InputBox(Prompt:="請輸入圖片版式:0=四周型,1=緊密型, " & vbLf & "3=襯於文字下方,4=浮於文字上方", Default:=0))
For Each oShape In ActiveDocument.InlineShapes
Set oShape = oShape.ConvertToShape
With oShape
Select Case shapeType
Case 0, 1
.WrapFormat.Type = shapeType
Case 3
.WrapFormat.Type = 3
.ZOrder 5
Case 4
.WrapFormat.Type = 3
.ZOrder 4
Case Else
Exit Sub
End Select
.WrapFormat.AllowOverlap = False
End With
Next
Else
For Each oShape In ActiveDocument.Shapes
oShape.ConvertToInlineShape
Next
End If
End Sub
⑸ 如何運用vba將指定圖片插入word中
例如,新建一個4行1列的表格,然後在版Cell(3, 1)內插入圖片:權
Sub Macro1()
Dim mysel
mysel = ActiveDocument.Tables(1).Cell(3, 1)
mysel.InlineShapes.AddPicture FileName:="C:\a.jpg", LinkToFile:=True, SaveWithDocument:=True
End Sub