Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default save cell as gif

Is it possible to save the contents of one cell as a gif?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default save cell as gif

Hi Tegger,

One way to do it is to select the current cell, press ctrl-c, open
MS-Paint and press ctrl-v. Go to 'File', 'Save-As' and select the 'Gif'
format and save the file with the appropriate name.

Hope this will help you.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default save cell as gif

so the answer is no - not directly. You would have to paste it in a chart
object and use the export command to do it in VBA.

--
Regards,
Tom Ogilvy

"zantor" wrote in message
...
Hi Tegger,

One way to do it is to select the current cell, press ctrl-c, open
MS-Paint and press ctrl-v. Go to 'File', 'Save-As' and select the 'Gif'
format and save the file with the appropriate name.

Hope this will help you.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default save cell as gif

Harald Staff wrote some code to do this. It is hosted on David McRitchie's
site:

http://www.mvps.org/dmcritchie/excel/xl2gif.htm

keywords:
chartobject
gif
export

--
Regards,
Tom Ogilvy

"Robin Hammond" wrote in message
...
Zantor,

This should get you going. You'll have to sort out the bit that hides
anything in the chart itself. Sometimes when I tried this there was data

in
the chart, other times it was blank, and the bit where I tried to set the
plotarea size to 0 doesn't really work to hide the chart itself. Easy to
write some code to get rid of anything in the chart though.

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
.PlotArea.Width = 0
.PlotArea.Height = 0
End With

chObj.Width = lWidth + 2
chObj.Height = lHeight + 2
chObj.Chart.Export strLocation, "GIF", False

rngCells.Select
chObj.Delete
End Sub


--
Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"Tom Ogilvy" wrote in message
...
so the answer is no - not directly. You would have to paste it in a

chart
object and use the export command to do it in VBA.

--
Regards,
Tom Ogilvy

"zantor" wrote in message
...
Hi Tegger,

One way to do it is to select the current cell, press ctrl-c, open
MS-Paint and press ctrl-v. Go to 'File', 'Save-As' and select the

'Gif'
format and save the file with the appropriate name.

Hope this will help you.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default save cell as gif

Zantor,

Having seen Tom's post I lifted the clearcontents line from Harald's code
which sorts out the problem with the contents of the chart. This one seems
to work quite well.

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


"Robin Hammond" wrote in message
...
Zantor,

This should get you going. You'll have to sort out the bit that hides
anything in the chart itself. Sometimes when I tried this there was data

in
the chart, other times it was blank, and the bit where I tried to set the
plotarea size to 0 doesn't really work to hide the chart itself. Easy to
write some code to get rid of anything in the chart though.

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
.PlotArea.Width = 0
.PlotArea.Height = 0
End With

chObj.Width = lWidth + 2
chObj.Height = lHeight + 2
chObj.Chart.Export strLocation, "GIF", False

rngCells.Select
chObj.Delete
End Sub


--
Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in


"Tom Ogilvy" wrote in message
...
so the answer is no - not directly. You would have to paste it in a

chart
object and use the export command to do it in VBA.

--
Regards,
Tom Ogilvy

"zantor" wrote in message
...
Hi Tegger,

One way to do it is to select the current cell, press ctrl-c, open
MS-Paint and press ctrl-v. Go to 'File', 'Save-As' and select the

'Gif'
format and save the file with the appropriate name.

Hope this will help you.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i save a varing value in a cell like Second? excel student Setting up and Configuration of Excel 0 October 30th 06 12:57 PM
how can I see/save a last cell value in excel? Eduardo Excel Worksheet Functions 1 May 5th 06 01:22 AM
Save file with cell name Brian Thompson via OfficeKB.com New Users to Excel 7 January 18th 06 09:11 PM
enter data in cell but cannot save until click off cell in excel T70McCains Excel Discussion (Misc queries) 1 November 18th 05 05:06 PM
automatic save cell to different cell james Excel Discussion (Misc queries) 1 January 5th 05 06:31 PM


All times are GMT +1. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"