|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 插入图片()
Dim pn$, fid As FileDialog, Doc As Document
Set fid = Application.FileDialog(3)
fid.Filters.Clear: fid.AllowMultiSelect = -1
fid.Filters.Add "图片文件", "*.emf;*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff"
Set Doc = ActiveDocument
Doc.Content.Text = Empty
With Doc.Sections(1)
l = .PageSetup.LeftMargin
t = .PageSetup.TopMargin
w = .PageSetup.PageWidth
h = .PageSetup.PageHeight
With .Footers(1)
.PageNumbers.Add 1
.Range.Font.Size = 16
.Range.Font.Name = "Times New Roman"
End With
End With
fid.InitialFileName = "\E:"
If fid.Show = -1 Then
For i = 1 To fid.SelectedItems.Count - 1
Selection.InsertBreak Type:=7
Next
For Each fn In fid.SelectedItems
n = n + 1
With Doc.GoTo(1, 1, n)
.Text = "EXCEL HOME 论坛"
.Font.Name = "Times New Roman"
.Font.Bold = -1
.Font.Size = 22
With Doc.Shapes.AddPicture(fn, 0, 1, -l, -t, w, h, .Duplicate)
.PictureFormat.TransparencyColor = RGB(255, 255, 255)
End With
End With
Next
End If
MsgBox "ok!"
End Sub
|
评分
-
2
查看全部评分
-
|