![vba-word表格插入图片_第1页](http://file4.renrendoc.com/view/33caee1c05db5a1de9f49ee9392f9b38/33caee1c05db5a1de9f49ee9392f9b381.gif)
![vba-word表格插入图片_第2页](http://file4.renrendoc.com/view/33caee1c05db5a1de9f49ee9392f9b38/33caee1c05db5a1de9f49ee9392f9b382.gif)
![vba-word表格插入图片_第3页](http://file4.renrendoc.com/view/33caee1c05db5a1de9f49ee9392f9b38/33caee1c05db5a1de9f49ee9392f9b383.gif)
![vba-word表格插入图片_第4页](http://file4.renrendoc.com/view/33caee1c05db5a1de9f49ee9392f9b38/33caee1c05db5a1de9f49ee9392f9b384.gif)
![vba-word表格插入图片_第5页](http://file4.renrendoc.com/view/33caee1c05db5a1de9f49ee9392f9b38/33caee1c05db5a1de9f49ee9392f9b385.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实用文档第页竭诚为您提供优质文档/双击可除vba,word表格插入图片
篇一:Vba统一处理woRd中的图片大小
subadjustpicwidthandheight()
alte
adjustpicwidthandheight宏
dimn,m
dimblnisinlineshapeasboolean
dimmylineshapeasinlineshape
onerrorResumenext忽略错误
Foreachmylineshapeinactivedocument.inlineshapes
ifmylineshape.height>mylineshape.widththen
selection.inlineshapes.converttoshape
selection.shapeRange.incrementRotation90
endif
next
Forn=1toactivedocument.inlineshapes.countinlineshapes类型的图片
h=activedocument.inlineshapes(n).height
w=activedocument.inlineshapes(n).width
activedocument.inlineshapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比ifh>wthen
blnisinlineshape=ture
selection.inlineshapes(n).converttoshape
selection.shapeRange.incrementRotation-90
endif
nextn
m=activedocument.inlineshapes.count
Forn=1to2inlineshapes类型的图片
activedocument.inlineshapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比
activedocument.inlineshapes(n).height=153设置图片高度为243px
activedocument.inlineshapes(n).width=243设置图片高度为153px
activedocument.inlineshapes(n).Range.paragraphs(1).Range.paragraphFormat.characterunitFirstlineindent=0
activedocument.inlineshapes(n).Range.paragraphs(1).Range.paragraphFormat.Firstlineindent=0
activedocument.inlineshapes(n).Range.paragraphs(1).Range.paragraphFormat.alignment=wdalignparagraphcenter
nextn
Forn=1to2inlineshapes类型的图片
activedocument.shapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.shapes(n).height=153设置图片高度为153px
activedocument.shapes(n).width=243设置图片高度为243px
nextn
Forn=3tominlineshapes类型的图片
activedocument.inlineshapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.inlineshapes(n).height=297设置图片高度为297px
activedocument.inlineshapes(n).width=405设置图片高度为405px
nextn
Forn=3tominlineshapes类型的图片
activedocument.shapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.shapes(n).height=297设置图片高度为297px
activedocument.shapes(n).width=405设置图片高度为405px
nextn
withselection.paragraphFormat
.leftindent=centimeterstopoints(0)
.Rightindent=centimeterstopoints(0)
.spacebefore=50
.spacebeforeauto=False
.spaceafter=50
.spaceafterauto=False
.linespacingRule=wdlinespacemultiple
.linespacing=linestopoints(3)
.alignment=wdalignparagraphcenter
.widowcontrol=False
.keepwithnext=False
.keeptogether=False
.pagebreakbefore=False
.nolinenumber=False
.hyphenation=true
.Firstlineindent=centimeterstopoints(0)
.outlinelevel=wdoutlinelevelbodytext
.characterunitleftindent=0
.characterunitRightindent=0
.characterunitFirstlineindent=0
.lineunitbefore=10
.lineunitafter=10
.mirrorindents=False
.textboxtightwrap=wdtightnone
.autoadjustRightindent=true
.disablelineheightgrid=False
.Fareastlinebreakcontrol=true
.wordwrap=true
.hangingpunctuation=true
.halfwidthpunctuationontopofline=False
.addspacebetweenFareastandalpha=true
.addspacebetweenFareastanddigit=true
.baselinealignment=wdbaselinealignauto
endwith
endsub
sub处理扫描照片()
处理扫描照片宏
dimn,m
dimblnisinlineshapeasboolean
dimmylineshapeasinlineshape
onerrorResumenext忽略错误
m=activedocument.inlineshapes.count
Forn=1to2inlineshapes类型的图片
activedocument.inlineshapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.inlineshapes(n).height=153设置图片高度为243px
activedocument.inlineshapes(n).width=243设置图片高度为153px
nextn
Forn=1to2inlineshapes类型的图片
activedocument.shapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.shapes(n).height=153设置图片高度为153px
activedocument.shapes(n).width=243设置图片高度为243px
nextn
Forn=3tominlineshapes类型的图片
activedocument.inlineshapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.inlineshapes(n).height=297设置图片高度为297px
activedocument.inlineshapes(n).width=405设置图片高度为405px
nextn
Forn=3tominlineshapes类型的图片
activedocument.shapes(n).lockaspectRatio=msoFalse不锁定图片的纵横比activedocument.shapes(n).height=297设置图片高度为297px
activedocument.shapes(n).width=405设置图片高度为405px
nextn
withselection.paragraphFormat
.leftindent=centimeterstopoints(0)
.Rightindent=centimeterstopoints(0).spacebefore=50
.spacebeforeauto=False
.spaceafter=50
.spaceafterauto=False
.linespacingRule=wdlinespacemultiple.linespacing=linestopoints(3)
.alignment=wdalignparagraphcenter.widowcontrol=False
.keepwithnext=False
.keeptogether=False
.pagebreakbefore=False
.nolinenumber=False
.hyphenation=true
.Firstlineindent=centimeterstopoints(0).outlinelevel=wdoutlinelevelbodytext.characterunitleftindent=0
.characterunitRightindent=0
.characterunitFirstlineindent=0.lineunitbefore=10
.lineunitafter=10
.mirrorindents=False
.textboxtightwrap=wdtightnone.autoadjustRightindent=true
.disablelineheightgrid=False
.Fareastlinebreakcontrol=true.wordwrap=true
.hangingpunctuation=true
.halfwidthpunctuationontopofline=False.addspacebetweenFareastandalpha=true.addspacebetweenFareastanddigit=true.baselinealignment=wdbaselinealignautoendwith
endsub
篇二:excel批量插入图片Vba代码
excel批量插入图片Vba代码(20xx-06-2408:56:26)转载标签:excel批量插入图片代码杂谈
在要插入图片的文件夹里新建一个excel文件,打开这个excel文件,在要插入图片的单元格里填上图片文件名(不要扩展名),选中要插入图片的单元格,修改单元格的大小以显示所需要的图片大小,运行宏代码。
1、alt+F11调取Vba编辑窗口,查看代码,将以下代码全部复制进去;
2、关闭Vba窗口,excel-视图-宏-查看宏;
3、book1.xls!sheet1.insertpic,选中所要插入图片的单元格,执行;
4、图片自动插入对应的单元格中。(图片尺寸均可通过单元格大小进行调解,边框可设置)
代码如下:
subinsertpic()
宏由万加美酒编写,时间:20xx-6-1
dir函数批量获取指定目录下所有文件名和内容
onerrorResumenext
application.screenupdating=False关闭屏幕更新
dimmRasRange
ForeachmRinselection
ifnotisempty(mR)anddir(activeworkbook.path当前文件所在目录下以当前单元内容为名称的.jpg图片
endif
next
setmR=nothing
application.screenupdating=true开启屏幕更新
endsub
我想"按一下按钮,插入图片"
我的vbacode如下:
subpicture_click_062020xx()
x=cells(8,4).Value
chdir"c:\users\myname\desktop\picture\"
activesheet.pictures.insert"x"+".jpg"
endsub
***cells(8,4)的值是图片的名称
我的vbacode有错...
activesheet.pictures.insert("c:\users\myname\desktop\picture\"
dummydoloop
Fori=65to66:Forj=65to66:Fork=65to66
Forl=65to66:Form=65to66:Fori1=65to66
Fori2=65to66:Fori3=65to66:Fori4=65to66
Fori5=65to66:Fori6=65to66:Forn=32to126
withactiveworkbook
.unprotectchr(i)bypassallfor...nexts
endif
endwith
next:next:next:next:next:next
next:next:next:next:next:next
loopuntiltrue
onerrorgoto0
endif
ifwintagandnotshtagthen
msgboxmsgonlyone,vbinformation,headeR
exitsub
endif
onerrorResumenext
Foreachw1inworksheets
attemptclearancewithpword1
w1.unprotectpword1
nextw1
onerrorgoto0
shtag=False
Foreachw1inworksheets
checksforallclearshtagtriggeredto1ifnot.
shtag=tectcontents
nextw1
ifshtagthen
Foreachw1inworksheets
withw1
tectcontentsthen
onerrorResumenext
dodummydoloop
Fori=65to66:Forj=65to66:Fork=65to66
Forl=65to66:Form=65to66:Fori1=65to66
Fori2=65to66:Fori3=65to66:Fori4=65to66
Fori5=65to66:F
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030全球5C超快充电池行业调研及趋势分析报告
- 2025年全球及中国火药量器行业头部企业市场占有率及排名调研报告
- 2025融资买卖合同范文
- 酒水购销合同模板
- 分期付款买卖合同参考范文
- 2025太原市购房合同范本范文
- 水果长期供应购销合同范本
- 2025厨房设备购买合同样本
- 灯具购销合同书范本
- 探索未知世界主题班会
- 2024年中考语文 (湖北专用)专题一 字音、字形课件
- T-ACEF 095-2023 挥发性有机物泄漏检测红外成像仪(OGI)技术要求及监测规范
- 2023年全国高考乙卷历史真题试卷及答案
- 骨科手术的术后饮食和营养指导
- 旅游定制师入行培训方案
- 2024年中国南方航空股份有限公司招聘笔试参考题库含答案解析
- 六年级上册数学应用题100题
- 个人代卖协议
- 赏析小说语言(二)
- 【立高食品公司的偿债能力现状及问题分析(论文9000字)】
- 10.《运动技能学习与控制》李强
评论
0/150
提交评论