Dear Respondent,
I used following code of VBScript in .asp, and it is working fine. I opened Excel workbook, and then inserting picture and then setting its position in shell, and then setting height of picture also.
Thanks, please see below code.
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Application.Visible = True
' Close all pending books
ExcelApp.Workbooks.Close
'Open the template
Set ExcelBook = ExcelApp.Workbooks.Open("\\DB_Server\DB\ExcelTemp\ TE_Template.XLS", , True)
lsFullFileName = "\\DB_Server\DB\ExcelTemp\TE_Template2.XLS"
If Not Isnull(Sponsor) then
str = "Select EmpFirstName+' '+EmpLastName as EmpName, left(EmpFirstName,1)+EmpLastName as Filename from employee_M Where EmpId = " & Sponsor
Rs.open str , conn
FileName = rs("FileName") & ".bmp"
Set mypic = ExcelBook.Worksheets(1).Pictures.Insert("\\db_serv er\db\exceltemp\dbs\" & FileName)
mypic.height = 18
mypic.Top = ExcelBook.Worksheets(1).Range("F7").Top
mypic.Left = ExcelBook.Worksheets(1).Range("F7").Left
ExcelBook.Worksheets(1).Cells(6, 5).Value = rs("EmpName")
Rs.close
End if
ExcelBook.SaveAs lsFullFileName
ExcelApp.WorkBooks.Close
ExcelApp.Application.Quit
Set ExcelApp = Nothing