Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joe,
As far as I am aware, yes. This is something I came up with earlier this week in response to another post. There are other similar solutions out there too. I haven't tested this much, but it seems to work ok. Sub Test() CopyRangeAsGif Selection, "c:\temp\test.gif" End Sub Sub CopyRangeAsGif(rngCells As Range, strLocation As String) Dim chNew As Chart Dim chObj As ChartObject Dim lWidth As Long Dim lHeight As Long Dim nCounter As Integer Dim shSource As Worksheet On Error GoTo 0 If InStr(rngCells.Address, ",") 0 Then MsgBox "Non contiguous range not permitted" Exit Sub End If With rngCells For nCounter = 1 To .Columns.Count lWidth = lWidth + .Columns(nCounter).Width Next nCounter For nCounter = 1 To .Rows.Count lHeight = lHeight + .Rows(nCounter).Height Next nCounter End With Set chNew = Charts.Add chNew.Location Whe=xlLocationAsObject, Name:=rngCells.Parent.Name Set shSource = rngCells.Parent Set chObj = shSource.ChartObjects(shSource.ChartObjects.Count) rngCells.CopyPicture xlScreen, xlPicture With ActiveChart .Paste .ChartArea.Border.LineStyle = 0 .ChartArea.ClearContents End With chObj.Width = lWidth + 4 chObj.Height = lHeight + 4 chObj.Chart.Export strLocation, "GIF", False rngCells.Select chObj.Delete End Sub -- Robin Hammond www.enhanceddatasystems.com Check out our XspandXL add-in "Joe 90" wrote in message ... I like the way one can export a chart to a gif, is it possible to export a picture in Excel. I like the way one can program to take a "picture of a range of cells, but want to be able to export this picture as a gif. is the only way to put it in a blank chart? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Connect a number to a picture bank and import that picture to exce | Excel Discussion (Misc queries) | |||
Export Excel tuncating leading zeros while export to excel from da | Setting up and Configuration of Excel | |||
export re-order input fields to export file [csv] | Excel Worksheet Functions | |||
insert a picture in to a comment but picture not save on hard disk | Excel Discussion (Misc queries) | |||
How to extract a picture from an Excel worksheet into a picture fi | Excel Discussion (Misc queries) |