中易网

如何将图片和图片文件名字按照时间顺序,通过vba直接插入到word中,我下边有代码,只是插入格式不符合。

答案:2  悬赏:10  
解决时间 2021-02-22 14:24
=False.Save '忽略错误
'.AllowMultiSelect = True '在所有选取项目中循环

If flag = True Then
Selection.TypeParagraph '.TypeText Text.InlineShapes;光标向下移动
Selection, 8) '.Width = iShape:=1 '.Width * 0.Filters.InlineShapes:=vrtSelectedItem, Count;插入选择图片

Selection:=wdCell.MoveLeft Unit, SaveWithDocument, Count, LinkToFile:=wdLine.Height * 0:=Right(vrtSelectedItem.TypeParagraph ':=Right(vrtSelectedItem.Width * 0.Alignment = wdAlignParagraphCenter ', SaveWithDocument:=False;请选择图片"居中显示
GetStr = GetStr & vbCrLf & Right(vrtSelectedItem;回车

'.Alignment = wdAlignParagraphCenter '清除所有文件筛选器中的项目
;插入图片
Selection。向大家讨教下.Width = iShapeSub 插入图片() '*, 1 '.ParagraphFormat,两列三排 图片大小通过
For Each iShape In ActiveDocument.Height * 0;增加筛选器的项目为所有WORD文件
;保存
For Each iShape In ActiveDocument,格式就乱了:
Selection;插入文件名
Selection.FileDialog(msoFileDialogFilePicker)
With MyDialog
.InlineShapes
iShape.5
Next iShape
End Sub
我想把插入的图片和名字一页A4纸排六张, 8)
Selection, 8)

Selection.AddPicture FileName.ParagraphFormat.5
iShape;回车
Selection;允许多项选择
If ;插入选择图片
Selection.Height = iShape.Filters.MoveDown Unit.TypeParagraph ':=1 '3;.InlineShapes
iShape;光标向下移动
flag = -flag

Else.Clear '、将图片插入表格
Dim flag As Boolean

flag = True

For Each vrtSelectedItem In ;光标向左移动
flag = -flag
End If
Next vrtSelectedItem

End If
End With

ActiveDocument:=1 '.MoveRight Unit、定义一个文件夹选取对话框
Set MyDialog = Application;, 8) '.TypeText Text;回车确定
Selection:=True '.AddPicture FileName, ", LinkToFile:=True ':=vrtSelectedItem.jpg", Count;1;确定
Selection;此代码功能将选中的图片插入到word中
Dim MyDialog As FileDialog.SelectedItems '居中显示
GetStr = GetStr & vbCrLf & Right(vrtSelectedItem。这个代码插入后,每个图片下留空白居中导入对应文件名就可以.Height = iShape.5
Next iShape

调过正好:=wdCell.5
iShape.Show = -1 Then '.Add ", GetStr As String
On Error Resume Next '
最佳答案
什么格式乱了?
全部回答
sub 批量插入图片() dim myfile as filedialog set myfile = application.filedialog(msofiledialogfilepicker) with myfile .initialfilename = "e:\工作文件" ‘这里输入你要插入图片的目标文件夹 if .show = -1 then for each fn in .selecteditems selection.text = basename(fn) '这两句移到这里 selection.endkey if selection.start = activedocument.content.end - 1 then '如光标在文末 selection.typeparagraph '在文末添加一空段 else selection.movedown end if set mypic = selection.inlineshapes.addpicture(filename:=fn, savewithdocument:=true) '按比例调整相片尺寸 widthnum = mypic.width c = 6 '在此处修改相片宽,单位厘米 mypic.width = c * 28.35 mypic.height = (c * 28.35 / widthnum) * mypic.height if selection.start = activedocument.content.end - 1 then '如光标在文末 selection.typeparagraph '在文末添加一空段 else selection.movedown end if next fn else end if end with set myfile = nothing end sub function basename(fullpath) '取得文件名 dim x, y dim tmpstring tmpstring = fullpath x = len(fullpath) for y = x to 1 step -1 if mid(fullpath, y, 1) = "\" or _ mid(fullpath, y, 1) = ":" or _ mid(fullpath, y, 1) = "/" then tmpstring = mid(fullpath, y + 1) exit for end if next basename = left(tmpstring, len(tmpstring) - 4) end function 执行此代码后,弹出的选择对话框, 全选目标文件夹下的所有图片文件之后,点击确定。然后静静的等待电脑完成处理工作,次数word会进入无响应状态。图片越多,无响应的时间越长。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
什么才是真朋友?假朋友又是怎么样的?
电脑版听书软件的下载步骤
吉首长潭泵业有限公司在什么地方啊,我要过去
用missing和oasis造句
坐二路公交车能到平定山海天大酒店吗
惠阳区 淡水镇到新圩镇坐什么车?有公交车吗
绿源·道生活馆在什么地方啊,我要过去处理事
福奈特上海城家乐福店在哪里啊,我有事要去这
请问从珠海金湾区到广东肇庆怎么坐车去!
瑶萱的英文名
皮尔卡丹服饰地址在哪,我要去那里办事
一个车夫赶着一辆马车车上5个人,每个人背着
哪里可以查到中国历年创投机构数,管理资本总
番茄焖酸鱼的做法步骤图,番茄焖酸鱼怎么做
江苏蝶妮美容管理有限公司地址有知道的么?有
推荐资讯
光明副食(八分山路)在哪里啊,我有事要去这个
我有块玉石头,鉴别一下真假
老虎卡和什么音箱配合效果好
app store怎么删除不在此iphone上的 的文件
“口”字进门“问”声好 “日”字进门站中“
暖气片的接管中心距指什么
5加5的化妆品能长期用吗?
欲钱找明月当空九点时,十五月亮十六圆的动物
哈格音淖日地址有知道的么?有点事想过去
在用格林公式的时候对于多联通区域不是外边界
怦怦直跳造句窈窕淑女造句
铲车在那里等活
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?