ntduong8th1
Thành viên mới

- Tham gia
- 2/5/12
- Bài viết
- 1
- Được thích
- 0
Function InsertPic(ByVal picname As String) As String
Dim pic As Shape, cell_ As Range
Dim mPath As String
mPath = "link ảnh"
Set cell_ = Application.ThisCell
On Error Resume Next
cell_.Worksheet.Shapes(cell_.Address).Delete
On Error GoTo 0
Set pic = cell_.Worksheet.Shapes.AddPicture(mPath & "\" & picname & ".jpg", _
msoFalse, msoTrue, cell_.Left, cell_.Top, cell_.Width, cell_.Height)
pic.LockAspectRatio = msoTrue
pic.Name = cell_.Address
Set cell_ = Nothing
End Function
Dim pic As Shape, cell_ As Range
Dim mPath As String
mPath = "link ảnh"
Set cell_ = Application.ThisCell
On Error Resume Next
cell_.Worksheet.Shapes(cell_.Address).Delete
On Error GoTo 0
Set pic = cell_.Worksheet.Shapes.AddPicture(mPath & "\" & picname & ".jpg", _
msoFalse, msoTrue, cell_.Left, cell_.Top, cell_.Width, cell_.Height)
pic.LockAspectRatio = msoTrue
pic.Name = cell_.Address
Set cell_ = Nothing
End Function