Hi,
Just want to see if anyone has any experience of inserting pictures into Excel using Excel 2010 onwards.
Been doing this for years using Excel 2000 (Yeah, I know a bit old but works great) and outputs an .XLS with some example code:
cFile = "\somefolder\somefile.jpg" cOutfile "\myfolder\outfile.xls" objexcel = CREATEOBJECT('excel.application') objexcel.Workbooks.Add
OBJexcel.Rows("2:2").RowHeight = 77 objexcel.Range("A2").Select objexcel.ActiveSheet.Pictures.Insert(cFile).Select objexcel.Selection.shaperange.height = 77 * add more pics into different cells
objexcel.ActiveWorkbook.SaveAs(cOutfile, xlWorkbookNormal) objexcel.ActiveWorkbook.Close objexcel.Quit
We usually output a spreadsheet of data and leave the first column blank so we can move through it and insert a picture.
Now we need to move to Office 365 to get a bit more up to date and output .XLSX files. :-(
I'm using office 2013/VFP 9 and the pictures it inserts are just links so that when you send it to somebody they can't view them. Done lots of searching of the internet and the archives etc and found an extra parameter for the insert:
objexcel.ActiveSheet.Pictures.Insert(cFile,.t.).Select
but this seems to make no difference set to .t. or .f.
There seems to be another way of doing it using shapes.
objexcel.application.activesheet.shapes.addpicture("H:\img_0536.jpg",.f.,.t.,1,1,100,100)
but I then need to move them to the correct location so still playing with that option.
Any help appreciated.
Thanks,