Adding pictures
Pictures are added to the Shapes collection with the AddPicture method. The syntax is as follows:
oSheet.Shapes.AddPicture(cFileName, lLinkToFile, lSaveWithDocument,
nLeft, nTop, nWidth, nHeight)
cFileName | Character | The fully pathed filename of the picture. |
lLinkToFile | Logical | Indicates whether to link the picture to the file from which it was created or to create a copy inside the document. |
lSaveWithDocument | Logical | Indicates whether to save the linked picture with the file or to store only the link information in the document. This argument must be True if lLinkToFile is False. |
nLeft, nTop | Numeric | The position (in points) of the upper-left corner of the picture, measured from the upper-left corner of the spreadsheet. |
nWidth, nHeight | Numeric | The width and height of the picture, in points. |
The following example adds the TasTrade logo to the worksheet. Be sure to fully qualify the path, as Excel does not know anything about VFP s defaults.
LogoFile = _SAMPLES + "TasTrade\Bitmaps\TTradeSm.bmp"
oSheet.Shapes.AddPicture(LogoFile, .T., .T., 32, 32, 72, 72)
A little playing is required when you re trying to determine the width and height of the graphic. None of the parameters are optional, so you need to know the width and height of any graphic you re adding.
Copyright 2000 by Tamar E. Granor and Della Martin All Rights Reserved