Code VBA chèn ảnh

Liên hệ QC

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
 
Đưa mấy dòng code lên chơi chơi vậy hả thớt?
 
Upvote 0
@ntduong8th1 giờ mình thêm cả vị trí đặt ảnh thì mình sửa code như nào thế bác?
 
Upvote 0
Web KT
Back
Top Bottom