Excelpromax123
Board Regular
- Joined
- Sep 2, 2021
- Messages
- 172
- Office Version
- 2010
- Platform
- Windows
I used this code to insert employee images into the payroll. On the file I made, it was OK, but when I brought this file to another computer, the image was blank. Please help me, thank you very much
VBA Code:
Sub chenhinhanh()
On Error Resume Next
Dim ws As Worksheet
Dim picPath As Variant
Dim pic As Picture
Set ws = ThisWorkbook.Sheets("bangluong")
picPath = Application.GetOpenFilename("Hinh Anh (*.jpg; *.jpeg; *.png), *.jpg; *.jpeg; *.png", , "Chon Hinh Anh")
If picPath = False Then Exit Sub
Set pic = ws.Pictures.Insert(picPath)
With pic
.Left = ws.Range("B2").Left
.Top = ws.Range("B2").Top
.Placement = xlMoveAndSize
.Name = "NhanVien"
End With
End Sub