欢迎来到天天文库
浏览记录
ID:53708680
大小:18.36 KB
页数:4页
时间:2020-04-06
《如何将图片批量导入word中并附加文件名.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、SubInsertPic() DimmyfileAsFileDialog Setmyfile=Application.FileDialog(msoFileDialogFilePicker) Withmyfile .InitialFileName="F:" If.Show=-1Then ForEachfnIn.SelectedItems Setmypic=Selection.InlineShapes.AddP
2、icture(FileName:=fn,SaveWithDocument:=True) '按比例调整相片尺寸 WidthNum=mypic.Width c=10 '在此处修改相片宽,单位厘米 mypic.Width=c*28.35 mypic.Height=(c*28.35/WidthNum)*mypic.Height
3、 IfSelection.Start=ActiveDocument.Content.End-1Then '如光标在文末 Selection.TypeParagraph '在文末添加一空段 Else Selection.MoveDown EndIf Selection.Text=Basename(fn) '函数取得文件名
4、 Selection.EndKey IfSelection.Start=ActiveDocument.Content.End-1Then '如光标在文末 Selection.TypeParagraph '在文末添加一空段 Else Selection.MoveDown EndIf Nex
5、tfn Else EndIf EndWith Setmyfile=NothingEndSubFunctionBasename(FullPath) '取得文件名 Dimx,y Dimtmpstring tmpstring=FullPath x=Len(FullPath) Fory=xTo1Step-1 IfMid(FullPath,y,1)=""Or_ Mid(FullPath,y,1)=":"O
6、r_ Mid(FullPath,y,1)="/"Then tmpstring=Mid(FullPath,y+1) ExitFor EndIf Next Basename=Left(tmpstring,Len(tmpstring)-4)EndFunction以上亲测可用!!!!如何将图片批量导入word中并附加文件名(2013-12-0410:44:35)转载▼标签:word批量导入照片文件名分类:电脑技术新建一个空白
7、的word文档。工具——》宏——》vb编辑器——》打开thisdocument——》把下面代码粘入编辑窗口——》保存 打开这个word文档——》工具——》宏——》执行 下面的不用我说了,最后记得通配符批量替换照片就可以一行显示多张了。 SubInsertPic() DimmyfileAsFileDialog Setmyfile=Application.FileDialog(msoFileDialogFilePicker) Withmyfile .InitialFileNam
8、e="F:" If.Show=-1Then ForEachfnIn.SelectedItems Setmypic=Selection.InlineShapes.AddPicture(FileName:=fn,SaveWithDocument:=True) '按比例调整相片尺寸 WidthNum=mypic.Wi
此文档下载收益归作者所有