StackOverflow shows some VBA code where LinkToFile False seems to do the trick (deep in the comments):
https://stackoverflow.com/questions/28181273/how-to-paste-insert-picture-not...
On Tue, Nov 1, 2016 at 10:33 AM, Peter Cushing pcushing@whisperingsmith.com wrote:
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,
-- Peter Cushing IT Department WHISPERING SMITH
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email. www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715 London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
[excessive quoting removed by server]