五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

WordVBA-批量整頁插入非嵌入式圖片-分析和解決問題全流程

2023-04-15 11:17 作者:ch_j  | 我要投稿

rem 本視頻代碼(路徑在您的電腦上,需要根據(jù)自己的實(shí)際情況改一下):


Sub 形狀插入()

Dim sp As Shape


Set sp = ActiveDocument.Shapes.AddPicture("E:\資料\學(xué)習(xí)\答疑\VBA\20230414批量插入圖片\圖片\01.jpg", Anchor:=ActiveDocument.Paragraphs.Last.Range)


With sp

.WrapFormat.Type = wdWrapBehind

.LockAspectRatio = True

If .Width / .Height >= .Anchor.Sections.First.PageSetup.PageWidth / .Anchor.Sections.First.PageSetup.PageHeight Then

'圖片寬高比大于等于圖片所在的頁面寬高比時(shí):

.Height = .Anchor.Sections.First.PageSetup.PageHeight

Else

.Width = .Anchor.Sections.First.PageSetup.PageWidth

End If


'設(shè)置水平和垂直對齊方式:相對于頁面居中

.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage

.Left = WdShapePosition.wdShapeCenter


.RelativeVerticalPosition = wdRelativeVerticalPositionPage

.Top = wdShapeCenter

End With

End Sub



'***在Word VBA中:形狀不能轉(zhuǎn)圖片,圖片可以轉(zhuǎn)形狀

Sub 圖片插入()

Dim isp1 As InlineShape

Set isp1 = ActiveDocument.InlineShapes.AddPicture("E:\資料\學(xué)習(xí)\答疑\VBA\20230414批量插入圖片\圖片\01.jpg", Range:=Selection.Range)


Dim sp As Shape

Set sp = isp1.ConvertToShape


With sp

.WrapFormat.Type = wdWrapBehind

.LockAspectRatio = True

If .Width / .Height >= .Anchor.Sections.First.PageSetup.PageWidth / .Anchor.Sections.First.PageSetup.PageHeight Then

'圖片寬高比大于等于圖片所在的頁面寬高比時(shí):

.Height = .Anchor.Sections.First.PageSetup.PageHeight

Else

.Width = .Anchor.Sections.First.PageSetup.PageWidth

End If


'設(shè)置水平和垂直對齊方式:相對于頁面居中

.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage

.Left = WdShapePosition.wdShapeCenter


.RelativeVerticalPosition = wdRelativeVerticalPositionPage

.Top = wdShapeCenter

End With

End Sub


Sub 批量插入圖片()

Dim fd As FileDialog

Dim s As String

Dim f As String

Set fd = Application.FileDialog(msoFileDialogFolderPicker)

With fd

.InitialFileName = ActiveDocument.Path

If .Show Then

s = Dir(.SelectedItems(1) & "\", vbNormal)

Do While s <> ""

f = .SelectedItems(1) & "\" & s

f = LCase(f)

Debug.Print f


'如果限定處理.jpg和.png文件

Dim s1 As String

s1 = Split(f, ".")(UBound(Split(f, ".")))

If s1 = "jpg" Or s1 = "png" Then

Dim sp As Shape


Set sp = ActiveDocument.Shapes.AddPicture(f, Anchor:=ActiveDocument.Paragraphs.Last.Range)


With sp

.WrapFormat.Type = wdWrapBehind

.LockAspectRatio = True

If .Width / .Height >= .Anchor.Sections.First.PageSetup.PageWidth / .Anchor.Sections.First.PageSetup.PageHeight Then

'圖片寬高比大于等于圖片所在的頁面寬高比時(shí):

.Height = .Anchor.Sections.First.PageSetup.PageHeight

Else

.Width = .Anchor.Sections.First.PageSetup.PageWidth

End If


'設(shè)置水平和垂直對齊方式:相對于頁面居中

.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage

.Left = WdShapePosition.wdShapeCenter


.RelativeVerticalPosition = wdRelativeVerticalPositionPage

.Top = wdShapeCenter

End With


ActiveDocument.Range.InsertParagraphAfter

ActiveDocument.Range.Paragraphs.Last.Range.InsertBreak WdBreakType.wdPageBreak

End If


s = Dir

Loop

End If

End With

End Sub

WordVBA-批量整頁插入非嵌入式圖片-分析和解決問題全流程的評論 (共 條)

分享到微博請遵守國家法律
北海市| 专栏| 济宁市| 和田市| 邛崃市| 苏尼特左旗| 宿州市| 普陀区| 左权县| 缙云县| 泰顺县| 塔河县| 康保县| 宜丰县| 兴城市| 新昌县| 木兰县| 太保市| 宁夏| 广州市| 都匀市| 麻栗坡县| 平凉市| 乌鲁木齐县| 壶关县| 鸡泽县| 北辰区| 韶关市| 兴和县| 乐山市| 景洪市| 晋江市| 滨海县| 饶阳县| 濮阳市| 鄄城县| 桃江县| 郸城县| 临夏市| 延寿县| 灵川县|