导航:首页 > 文件教程 > wordvba图片提示

wordvba图片提示

发布时间:2025-02-16 03:35:44

⑴ 想在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

阅读全文

与wordvba图片提示相关的资料

热点内容
creo工程图配置文件 浏览:699
编程和钢琴哪个贵 浏览:841
移动进销存app哪个好 浏览:600
编程制作游戏什么原理 浏览:97
linux如何查看是否有共享文件夹 浏览:264
u盘拷贝文件以后为空 浏览:917
快云主机数据库连接方法 浏览:756
javagsp定位 浏览:384
jsp页面表格导出excel 浏览:976
imagetest教程 浏览:244
怎样将一个cad文件包图纸兼容 浏览:898
论文有什么好的网站 浏览:581
jdk7javadoc 浏览:687
编程小游戏是如何设计的 浏览:913
网络安全风险案例 浏览:46
司法考试哪个网站好 浏览:469
android搜索功能代码 浏览:437
文件名如何没有文字 浏览:601
吃鸡地图资源包文件路径 浏览:267
cad文件转移手机 浏览:733

友情链接