|
发表于 2024-10-17 08:56
来自手机
|
显示全部楼层
本帖最后由 lss001 于 2024-10-17 13:06 编辑
'以下把注释全部清除,以免产生误导
Sub shpImg()
Dim sht As Worksheet, shp As Shape
Dim Apath As String
Dim imgCont As Object
Apath = ThisWorkbook.Path & "\BliT.bmp"
Set sht = ActiveSheet
Call delshp
ActiveWindow.DisplayGridlines = False
Set imgCont = sht.OLEObjects.Add(ClassType:="Forms.Image.1", Link:=False, DisplayAsIcon:=False, Left:=60, Top:=60, Width:=400, Height:=300)
With imgCont
.Object.BorderStyle = fmBorderStyleNone
.Object.PictureSizeMode = fmPictureSizeModeClip
.Object.PictureAlignment = fmPictureAlignmentCenter
.Object.Picture = LoadPicture(Apath)
.Visible = True
.Locked = True
End With
t = Timer
While Timer < t + 2: VBA.DoEvents: Wend
imgCont.Select
'Selection.CopyPicture
Selection.Copy
Dim shp1 As Shape
Set shp1 = sht.Shapes(1)
With sht.ChartObjects.Add(0, 0, shp1.Width, shp1.Height).Chart
.Parent.Select
.Paste
.Export ThisWorkbook.Path & "\dImg.jpg", "JPG"
.Parent.Delete
End With
MsgBox "ok!"
End Sub
Sub delshp()
Dim shp As Shape
On Error Resume Next
For Each shp In ActiveSheet.Shapes
shp.Delete
Next
End Sub |
评分
-
1
查看全部评分
-
|