Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now