NamedRange.CopyPicture(XlPictureAppearance, XlCopyPictureFormat) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Copies the NamedRange control to the Clipboard as a picture.
public object CopyPicture (Microsoft.Office.Interop.Excel.XlPictureAppearance Appearance = Microsoft.Office.Interop.Excel.XlPictureAppearance.xlScreen, Microsoft.Office.Interop.Excel.XlCopyPictureFormat Format = Microsoft.Office.Interop.Excel.XlCopyPictureFormat.xlPicture);
abstract member CopyPicture : Microsoft.Office.Interop.Excel.XlPictureAppearance * Microsoft.Office.Interop.Excel.XlCopyPictureFormat -> obj
Public Function CopyPicture (Optional Appearance As XlPictureAppearance = Microsoft.Office.Interop.Excel.XlPictureAppearance.xlScreen, Optional Format As XlCopyPictureFormat = Microsoft.Office.Interop.Excel.XlCopyPictureFormat.xlPicture) As Object
Parameters
- Appearance
- XlPictureAppearance
Specifies how the picture should be copied.Can be one of the following XlPictureAppearance constants: xlPrinterxlScreen
- Format
- XlCopyPictureFormat
The format of the picture.Can be one of the following XlCopyPictureFormat constants: xlBitmapxlPicture
Returns
Examples
The following code example creates a NamedRange and populates it with the word Smith. It then uses the CopyPicture method to copy the NamedRange to the Clipboard as a bitmap.
This example is for a document-level customization.
Microsoft.Office.Tools.Excel.NamedRange copyBitmapRange;
private void CopyAsBitmap()
{
copyBitmapRange = this.Controls.AddNamedRange(
this.Range["C3"], "copyBitmapRange");
this.copyBitmapRange.Value2 = "Smith";
this.copyBitmapRange.CopyPicture(
Excel.XlPictureAppearance.xlScreen,
Excel.XlCopyPictureFormat.xlBitmap);
}
Private copyBitmapRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub CopyAsBitmap()
copyBitmapRange = Me.Controls.AddNamedRange( _
Me.Range("C3"), "copyBitmapRange")
Me.copyBitmapRange.Value2 = "Smith"
Me.copyBitmapRange.CopyPicture( _
Excel.XlPictureAppearance.xlScreen, _
Excel.XlCopyPictureFormat.xlBitmap)
End Sub
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.