Solved

Foxpro - How do I programmatically add a pic to an Excel SS

Posted on 2010-09-07
3
450 Views
Last Modified: 2012-05-10
I've been writing reports to Excel via Foxpro for years but unitl now I've never had to include an image.  This particual report concerns lab results where reference range explanations are quite long for two particular tests.  Since I need to provide all the results for an exam on one 8.5X11 sheet it's important that I not use one row per reference range line explanation and that's why I'm opting to include an image (see attached) instead.  I've also include a sample of the lab result report.  The list of test result is always different and may or may not include the two test results with the reference ranges that I've highlighted.  Please include your recommendations or a code sample.  Thanks in advance for your help.  For refrence, the change I'm incorporating is to an old VFP 6 application.
labsliptemplate.htm
HbA1c.jpg
0
Comment
Question by:NIDDK1550
3 Comments
 
LVL 12

Expert Comment

by:jrbbldr
ID: 33621181
The place to start with anything like this is to do the same work manually in Excel and record the operations in an Excel Macro.

Then go into the Macro and examine the steps that it recorded.  Yes it will be in VBA code rather than VFP, but typically it is not too difficult to see what is going on and convert it to VFP Automation code.

Good Luck

0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33621493
No need to put this into an image, you can do multiline text into a cell by typing ALT+RETURN. In code you simply set a cell value to multiline text with CHR(10) as line feeds. I don't see why you would need pictures to do this.

Otherwise there is no such thing as a picture in a cell, pictures are put on a sheet as far as I found out. You can do ActiveSheet.Pictures.Insert ("C:\...\some.jpg") and the picture will be on the sheet, it can be positioned anywhere and is not bound to cells.

Bye, Olaf.
0
 
LVL 27

Accepted Solution

by:
CaptainCyril earned 500 total points
ID: 33622520
cMyPicture = SYS(5)+SYS(2003)+'logo.bmp' && a sample file

xlsheet.Columns(1).ColumnWidth = 4.25
xlsheet.Range("A1").Select
xlshape = xlsheet.Pictures.Insert(platformfile(cMyPicture)
WITH xlshape
*      .LockAspectRatio = msoTrue
      .Height = .Height*3/4 && three quarters of the logo's height
      .Width = .Width*3/4 && three quarters of the logo's width
ENDWITH
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question