我有7个盒子,我想根据当天在每个盒子上插入不同的图片。
如果可以在当天开始的7天内自动更改网址中的日期,我就会徘徊。
Sub foto()
With ActiveSheet.Pictures.Insert("http://www.balbala.com/blabla/20180216/balbla/bla")
With .ShapeRange
.LockAspectRatio = msoFalse
.Width = 290
.Height = 240
End With
.Left = ActiveSheet.Range("F3").Left
.Top = ActiveSheet.Range("F3").Top
End With
End Sub
提前致谢
答案 0 :(得分:0)
尝试将列出URL的行更改为以下内容:
With ActiveSheet.Pictures.Insert("http://www.balbala.com/blabla/" & Format(Date(), "yyyymmdd") & "/balbla/bla")
答案 1 :(得分:0)
Sub foto()
Dim d As Date
Dim sito(0 To 2) As String
Dim SitoFr As String
sito(0) = "http://www.blabla/blab/
sito(1) = "20180217"
sito(2) = "/blabla/blabla/bl.gpg"
SitoFr = sito(0) + sito(1) + sito(2)
With ActiveSheet.Pictures.Insert(SitoFr)
With .ShapeRange
.LockAspectRatio = msoFalse
.Width = 290
.Height = 240
End With
.Left = ActiveSheet.Range("F3").Left
.Top = ActiveSheet.Range("F3").Top
End With
End Sub