Solved

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

Posted on 2010-09-07
3
435 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

776 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