vba, excel, ID card, photo

Sub insert picture()     ' Resize cells to fit picture size function Insert ID photo print - front in cell d6 back in cell d10
 
   ActiveSheet.Pictures.Delete 'Clear expired photos
Range("d6").Select

   Dim aa
aa = ActiveSheet.Range( " j1 " ).Value ' The value of J1 of the active sheet = Photo (positive) path 

    ActiveSheet.Pictures.Insert(aa).Select    
Dim sh As Shape
    For Each sh In ActiveSheet.Shapes
        sh.LockAspectRatio = False
        sh.Left = sh.TopLeftCell.Left
        sh.Top = sh.TopLeftCell.Top
        sh.Width = sh.TopLeftCell.Width
        sh.Height = sh.TopLeftCell.Height
    Next sh

Call cha

End Sub
Sub cha ()
Range("d10").Select

   Dim aa
aa = ActiveSheet.Range( " j2 " ).Value ' The value of J2 of the active sheet = photo (reverse) path 
    ActiveSheet.Pictures.Insert(aa).Select         ' The .jpg picture with the unit content as the name in the directory where the current file is located 
Dim sh As Shape
    For Each sh In ActiveSheet.Shapes
        sh.LockAspectRatio = False
        sh.Left = sh.TopLeftCell.Left
        sh.Top = sh.TopLeftCell.Top
        sh.Width = sh.TopLeftCell.Width
        sh.Height = sh.TopLeftCell.Height
    Next sh
  
End Sub

Feature Insert ID Photo Print - Front in Cell D6 Reverse in Cell D10

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325018441&siteId=291194637