Skip to main content

Posts

Showing posts with the label insert and print image in excel through code

Inserting picture in worksheet using macro

Summary: Inserting picture in worksheet using macro. Details Sub Insert_ImagePic() Dim wks As Worksheet Dim Copies As Variant Dim strPath As String Dim strFileNm As String Dim Pic '-- ' Reference active sheet On Error Resume Next Set wks = ActiveSheet ' Better solution is to reference specified worksheet, e.g.: ' In this example worksheet name = 'ImagePic', customize name Set wks = ThisWorkbook.Worksheets("ImagePic") ' Check if sheet exists If wks Is Nothing Then MsgBox "Active sheet is not Worksheet...'" & vbLf & _ "Please select Worksheet.... and recall procedure.", _ vbExclamation, "Insert ImagePic" Exit Sub End If On Error GoTo 0 ' Initialize File name and Path (you use ComboBox) ' Customize File name and Path strPath = "C:\Users\Andro\Desktop\Articles\avXl...