I am writing VB script to insert the images from directory to Excel file with caption to images.
While I am running below code I am getting the error :
Error
Script: C:\Users\user\Desktop\asd.vbs
Line: 7
Char: 13
Error: Type mismatch: 'range'
Code: 800A000D
Source: Microsoft VBScript runtime error
Code :-
set objExcel = CreateObject("Excel.Application")
objExcel.Application.DisplayAlerts = False
set objWorkbook=objExcel.workbooks.add()
With objExcel.ActiveSheet.Pictures.insert("C:\Users\user\Desktop\test\IMG_9717.JPG")
.Left = range("A").Left
.Top = range("A").Top
.Height = range("A").RowHeight
.Placement = xlMoveAndSize
End With
objWorkbook.Saveas "c:\testXLS1.xls"
objWorkbook.Close
objExcel.workbooks.close
objExcel.quit
set objExcel = nothing
Please guide me on above error. How can I fix this ?