|  | 
 
 发表于 2017-8-3 00:23:27
|
显示全部楼层 
| Sub insertpic() '
 ' 筿?彻?ボ虫ノ
 '
 
 PLeft = Selection.Information(wdHorizontalPositionRelativeToPage)
 PTop = Selection.Information(wdVerticalPositionRelativeToPage)
 PLPOS = Selection.Information(wdHorizontalPositionRelativeToTextBoundary)
 
 Dim Sh As Object, PS As Object
 Set PS = ThisDocument.PageSetup
 
 'MsgBox (PLeft & "  " & PTop)
 
 Dim arr(0 To 1) As Variant
 
 Set myDocument = ActiveDocument
 With myDocument.Shapes
 
 With .AddPicture(FileName:="E:\Study\office\word\au3bbsproblem\2\999.jpg", LinkToFile:=False, SaveWithDocument:=True, Left:=PS.LeftMargin, Top:=PS.TopMargin)
 .Name = "shp1"
 arr(0) = .Name
 
 End With
 
 
 
 Set Sh1 = ThisDocument.Shapes("shp1")
 
 Sh1.Select
 
 With ThisDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, PS.LeftMargin, PS.TopMargin, Sh1.Width, Sh1.Height)
 .Name = "shp2"
 .Line.Visible = msoFalse
 .Fill.Transparency = 1
 With .TextFrame
 .VerticalAnchor = msoAnchorMiddle
 With .TextRange
 .ParagraphFormat.Alignment = wdAlignParagraphCenter
 .Font.Size = 7.5
 '.Font.Name = "夹发砰"
 .Font.ColorIndex = wdBlue
 .Text = Format(Date, "yyyy.mm.dd")
 End With
 End With
 End With
 
 Set Sh2 = ThisDocument.Shapes("shp2")
 
 Dim target_left, target_top As Single
 
 
 With Sh1
 target_left = .Left
 target_top = .Top
 End With
 
 
 
 With Sh2
 
 .Left = target_left
 
 .Top = target_top
 End With
 
 
 
 ' With .Range(Array("shp1", "shp2")).Group
 '.Fill.PresetTextured msoTextureBlueTissuePaper
 '.Rotation = 45
 ' .ZOrder msoSendToBack
 ' End With
 
 
 End With
 
 End Sub
 | 
 |