Mobiius has introduced me to vbscript which when integrated in my DBP program creates an Excel spread sheet and formats cells.
I write to a .vbs file and then execute this file to run the vbs.
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False 'Hide the excel window.
Set objWorkbook = objExcel.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)
intRow = 2
objWorksheet.Cells(1,1) = "First Name"
objWorksheet.Cells(1,2) = "Initials"
objWorksheet.Cells(1,3) = "Last Name"
objWorksheet.Cells(1,4) = "Full Name"
objExcel.Cells(intRow, 1).Value = "Elvis"
objExcel.Cells(intRow, 2).Value = "A"
objExcel.Cells(intRow, 3).Value = "Presley"
objExcel.Cells(intRow, 4).Value = "Elvis Presley"
objExcel.Cells.EntireColumn.AutoFit
objExcel.ActiveWorkbook.SaveAs "U:\test.xlsx"
objExcel.Workbooks.close
objExcel.Application.Quit
MsgBox "Done"
I have now ben able to insert an image into the spread sheet using
Write Datafile String 1, "objExcel.ActiveSheet.Pictures.Insert (" + Chr$(34) + "C:\fullpath\my_image.png" + Chr$(34) + ")"
but I am unable to position it to where I would like.
I understand that I should be able to position the image using a top and left cell reference but after several days searching and trying I am unable to achieve any positioning.
Can anyone help me based on the previous code styling.