|
楼主 |
发表于 2016-12-26 21:06
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
找了论坛中这个可以,但是不会修改成直接载入指定路径的版本(即是不打开文件选择夹供选择)- Sub 插入图片()
- Dim myfile As FileDialog
- Dim myW As Single, myH As Single
-
- myW = InputBox("请输入图片宽度,单位:厘米", , 6)
- myH = InputBox("请输入图片高度,单位:厘米", , 5.5)
-
- Set myfile = Application.FileDialog(msoFileDialogFilePicker)
- With myfile
- .InitialFileName = "C:"
- If .Show = -1 Then
- For Each fn In .SelectedItems
- Set mypic = Selection.InlineShapes.AddPicture(FileName:=fn, SaveWithDocument:=True)
- mypic.Width = CentimetersToPoints(myW)
- mypic.Height = CentimetersToPoints(myH)
- Next fn
- End If
- End With
- Set myfile = Nothing
- End Sub
复制代码
|
|