社区
VBA
帖子详情
关于Shapes.AddPicture 尾后的意思
ygxshanghai
2012-05-29 10:57:30
Doc.Shapes.AddPicture App.Path & "\picture2.jpg", False, True, 50, 100, 150, 200中的False, True, 50, 100, 150, 200,这些是什么意思?谢谢
...全文
620
6
打赏
收藏
关于Shapes.AddPicture 尾后的意思
Doc.Shapes.AddPicture App.Path & "\picture2.jpg", False, True, 50, 100, 150, 200中的False, True, 50, 100, 150, 200,这些是什么意思?谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
贝隆
2012-06-18
打赏
举报
回复
http://download.csdn.net/detail/veron_04/1627134
贝隆
2012-06-18
打赏
举报
回复
在文档中添加一幅图片。返回一个 Shape 对象,该对象代表图片,并将其添加至 Shapes 集合。
expression.AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height, Anchor)
expression 必需。该表达式返回一个 Shapes 对象。
FileName String 类型,必需。图片的路径和文件名。
LinkToFile Variant 类型,可选。如果为 True,则将图片链接到创建该对象的文件;如果为 False,则将图片作为该文件的独立副本。默认值是 False。
SaveWithDocument Variant 类型,可选。如果为 True,则将链接的图片与文档一起保存。默认值是 False。
Left Variant 类型,可选。新图片的左边缘相对于锁定区域的位置,以磅为单位。
Top Variant 类型,可选。新图片的上边缘相对于锁定区域的位置,以磅为单位。
Width Variant 类型,可选。图片的宽度,以磅为单位。
Height Variant 类型,可选。图片的高度,以磅为单位。
Anchor Variant 类型,可选。指定图片的锁定区域。如果指定了 Anchor,锁定标记位于锁定区域第一段的段首。如果忽略此参数,则自动放置锁定标记,而图片参照页面的上边缘和左边缘定位。
pengderun
2012-06-18
打赏
举报
回复
VBA有帮助可查看的,以后可自己去查
pengderun
2012-06-18
打赏
举报
回复
Word 开发人员参考
Shapes.AddPicture 方法
在绘图画布上添加一幅图片。返回一个 Shape 对象,该对象代表图片并将其添加至 CanvasShapes 集合。
语法
表达式.AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)
表达式 必选。一个代表 Shapes 集合的变量。
参数
名称 必选/可选 数据类型 说明
FileName 必选 String 图片的路径和文件名。
LinkToFile 可选 Variant 如果该参数值为 True,则将图片链接到创建它的文件。如果该参数值为 False,则将图片作为该文件的独立副本。默认值为 False。
SaveWithDocument 可选 Variant 如果该参数值为 True,则将链接的图片与文档一起保存。默认值为 False。
Left 可选 Variant 新图片的左边缘相对于绘图画布的位置,以磅为单位。
Top 可选 Variant 新图片的上边缘相对于绘图画布的位置,以磅为单位。
Width 可选 Variant 图片的宽度,以磅为单位。
Height 可选 Variant 图片的高度,以磅为单位。
ygxshanghai
2012-05-30
打赏
举报
回复
自己顶一下,高手请进。
Excel-VBA常用技巧-第04章shape(图形)、Chart(图表)对象.docx
Excel-VBA常用技巧-第04章shape(图形)、Chart(图表)对象.docx
Microsoft.Office.Interop.Word.dll
Microsoft.Office.Interop.Word.dll 事例如 object Nothing = System.Reflection.Missing.Value; object srcFileName = @"D:\aa.html"; object dstFileName = @"d:\li.doc"; object objt = true; Word.Application wordApp = new Word.ApplicationClass(); Word.Document wordDoc = null; object format = Word.WdSaveFormat.wdFormatDocument; try { wordDoc = wordApp.Documents.Open(ref srcFileName, ref format, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); //图片 Word.Shape oShape = wordDoc.
Shapes
.
Add
Pic
tu
re("D:\\DL_01.gif", ref Nothing, ref objt, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); oShape.WrapFormat.Type = Word.WdWrapType.wdWrapSquare; //将htm文件save as成doc文件 wordDoc.SaveAs(ref dstFileName, ref format, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); } finally { wordDoc.Close(ref Nothing, ref Nothing, ref Nothing); wordApp.Quit(ref Nothing, ref Nothing, ref Nothing); } }
JS宏和VBA条形码二维码生成插件
Excel VBA 或者 WPS JS宏 要批量生成二维码或者条形码,一般通过网络请求的方式从网站上获取,对于不能联网的电脑非常麻烦。 另类的解决办法:利用bwip-js包,通过node.js环境搭建本地服务器 ,将其打包成exe可执行文件,就可以通过本地获取二维码、条形码图片,在WPS宏编辑器、VBA编辑器中,用
Shapes
.
Add
Pic
tu
re 方法即可向工作表插入需要的条形码、二维码图片 实测扫码枪、盘点机可以正确识别。支持Win7 / Win10 / Win11 64位系统,32位系统没测试过不清楚。 bwip-js支持:Code11、Code128、Code39、Code93、EAN-13、QR Code(二维码)、ISBN、ISMN、PDF417 、Datamatrix等105种类型 内有JS宏生成条形码标签示例
照片批量自动插入
批量照片自动插入不再是难题,一键全插入VBA代码如下: Option Explicit Sub Insert
Pic
tu
re() Dim MyShape As Shape Dim r As Integer Dim c As Integer Dim
Pic
Path As String Dim
Pic
rng As Range With Sheet1 For Each MyShape In .
Shapes
If MyShape.Type = 13 Then MyShape.Delete End If Next For r = 7 To .Cells(.Rows.Count, 7).End(xlUp).Row Step 10 For c = 6 To 6
Pic
Path = ThisWorkbook.Path & "\" & .Cells(r, c).Text & ".jpg" If Dir(
Pic
Path) <> "" Then Set MyShape = .
Shapes
.
Add
Pic
tu
re(
Pic
Path, False, True, 250, 250, 250, 250) Set
Pic
rng = .Range(Cells(r - 4, c - 4), Cells(r + 1, c - 4)) With MyShape .LockAspectRatio = msoFalse .Top =
Pic
rng.Top + 1.5 .Left =
Pic
rng.Left + 1.5 .Width =
Pic
rng.Width - 1.5 .Height =
Pic
rng.Height - 1.5 .TopLeftCell = "" End With Else .Cells(r - 4, c - 4) = "暂无照片" End If Next Next End With Set MyShape = Nothing Set
Pic
rng = Nothing End Sub Sub MyName() Dim MyName As String Dim r As Integer r = 7 MyName = Dir(ThisWorkbook.Path & "\" & "*.jpg") Do While MyName <> "" If MyName <> ".jpg" And MyName <> ".." Then Cells(r, 6) = MyName r = r + 10 Else Cells(r, 6).ClearContents End If MyName = Dir Loop Cells.Replace What:=".jpg", Replacement:="", LookAt:=xlPart, SearchOrder _ :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False End Sub
Add
a
Pic
tu
re to a Microsoft Word Document
Demonstration script that
add
s a
pic
tu
re (C:\Scripts\Logo.jog) to a Microsoft Word document 代码如下:Set objWord = CreateObject(“Word.Application”) objWord.Visible = True Set objDoc = objWord.Documents.
Add
() Set objSelection = objWord.Selection Set objShape = objDoc.
Shapes
objShape.
Add
Pic
tu
re(“C:\Script
VBA
2,464
社区成员
10,807
社区内容
发帖
与我相关
我的任务
VBA
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
复制链接
扫一扫
分享
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章