Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Saving ranges as GIFs

Sub SaveChartAsGIF()
Fname = ThisWorkbook.Path & "\" & ActiveChart.Name & ".gif"
ActiveChart.Export Filename:=Fname, FilterName:="GIF"
End Sub

I'd like to adapt the above code so that it acts on a linked range of data
rather than a chart. I created the data range from an existing area of a
worksheet using the Camera tool. The objective is to save the data range as a
static picture so that I can use it in other applications. It would be more
helpful if the macro could refer to these ranges by a name rather than having
to manually activate the ranges. I am familiar with the process of renaming a
chart object instead of it being called "Chart1" etc I asssume that I would
follow the same convention in renaming these linked data ranges. Thanks in
advance for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving ranges as GIFs


Can use the "Range.CopyPicture" function,and get date from Clipboar
with API

--
bighea

-----------------------------------------------------------------------
bighead's Profile: http://www.excelforum.com/member.php...fo&userid=2704
View this thread: http://www.excelforum.com/showthread.php?threadid=46644

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Saving ranges as GIFs

Your suggestion would be a step in the right direction but ideally I would
like to have the macro automate the process of writing the ranges to a folder
as GIfs or JPGs etc in the same way as in the example code that I submitted.

"bighead" wrote:


Can use the "Range.CopyPicture" function,and get date from Clipboard
with API.


--
bighead


------------------------------------------------------------------------
bighead's Profile: http://www.excelforum.com/member.php...o&userid=27048
View this thread: http://www.excelforum.com/showthread...hreadid=466443


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Saving ranges as GIFs

David McRitchie has some code from Harald Staff. You may find it interesting.
http://www.mvps.org/dmcritchie/excel/xl2gif.htm



Ben wrote:

Your suggestion would be a step in the right direction but ideally I would
like to have the macro automate the process of writing the ranges to a folder
as GIfs or JPGs etc in the same way as in the example code that I submitted.

"bighead" wrote:


Can use the "Range.CopyPicture" function,and get date from Clipboard
with API.


--
bighead


------------------------------------------------------------------------
bighead's Profile: http://www.excelforum.com/member.php...o&userid=27048
View this thread: http://www.excelforum.com/showthread...hreadid=466443



--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving ranges as GIFs


A example ...............


+-------------------------------------------------------------------+
|Filename: saveRangBmp.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3800 |
+-------------------------------------------------------------------+

--
bighead


------------------------------------------------------------------------
bighead's Profile: http://www.excelforum.com/member.php...o&userid=27048
View this thread: http://www.excelforum.com/showthread...hreadid=466443



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Saving ranges as GIFs

Hi,

in excel 2000 and later versions, you can create a picture by copying
and pasting, and save it as a part of a web page. (no options for the
quality like compression ratio)
for example,

Sub SavePicture(Target As Object, Filename As String, _
Optional CopyBitmap As Boolean = False)
Dim TmpHtml As String, TmpFolder As String
Dim TmpFile As String, PictureFormat As String

TmpHtml = ThisWorkbook.Path & "\_tmp.htm"
TmpFolder = ThisWorkbook.Path & "\_tmp.files"

Select Case UCase(Right(Filename, 3))
Case "GIF": PictureFormat = "Picture (GIF)"
Case "JPG": PictureFormat = "Picture (JPEG)"
Case "PNG": PictureFormat = "Picture (PNG)"
Case Else: Exit Sub
End Select

If CopyBitmap Then
Target.CopyPicture xlScreen, xlBitmap
Else
Target.CopyPicture xlScreen, xlPicture
End If

Application.ScreenUpdating = False
With Workbooks.Add(xlWorksheet)
With .Worksheets(1)
.Paste
Selection.Cut
.PasteSpecial PictureFormat
End With
Application.DisplayAlerts = False
.SaveAs Filename:=TmpHtml, FileFormat:=xlHtml
.Close False
Application.DisplayAlerts = True
End With
Application.ScreenUpdating = True

TmpFile = Dir(TmpFolder & "\*." & Right(Filename, 3))
If TmpFile < "" Then
FileCopy TmpFolder & "\" & TmpFile, Filename
End If

On Error Resume Next
Kill TmpFolder & "\*.*"
Kill TmpHtml
RmDir TmpFolder
On Error GoTo 0
End Sub

Sub Test_SavePicture()
If ThisWorkbook.Path = "" Then Exit Sub
SavePicture Range("A1:C10"), ThisWorkbook.Path & "\range.gif"
End Sub

--
HTH,

okaizawa


Ben wrote:
Your suggestion would be a step in the right direction but ideally I would
like to have the macro automate the process of writing the ranges to a folder
as GIfs or JPGs etc in the same way as in the example code that I submitted.

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
Need Help Converting Hypertext GIFs [email protected] Excel Worksheet Functions 2 December 1st 08 09:53 PM
Saving data ranges for Vlookups msiegmund Excel Discussion (Misc queries) 1 June 22nd 07 08:37 PM
Drop down list with gifs Chrisrose Excel Discussion (Misc queries) 1 July 20th 06 08:29 PM
Saving files with names from ranges Maria[_6_] Excel Programming 7 November 9th 03 09:21 PM
Exporting Charts as GIFs Adam Sparks Excel Programming 4 November 4th 03 11:05 PM


All times are GMT +1. The time now is 10:32 AM.

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

About Us

"It's about Microsoft Excel"