Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


VB Virgin

Posted on 2004-10-27
Medium Priority
Last Modified: 2010-05-02
I have been asked to write a macro that exports an excel chart and converts it to a gif file.  I said yes, but to what, I did not know...

Can someone help me?  I know nothing about vb (nothing being the key word).

Question by:frecha
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

by:Shahid Thaika
ID: 12423281
You can try looping through all the columns and rows of the excel chart and print it to a picturebox control. Then you can save the image of the picture box control.
LVL 29

Accepted Solution

leonstryker earned 150 total points
ID: 12423428
LVL 16

Expert Comment

ID: 12432318
Personally, if you've got $40 to spare, I'd look up the print-to-image driver at http://www.zan1011.com/feature_bitmap.htm.  Then you can print your chart to a bmp file, which can be easily converted to a gif.  

Or, add a Microsoft Office Chart control to a form, load your chart to it and use the following librbary to copy an area to the clipboard:  http://www.vbcode.com/asp/showzip.asp?ZipFile=capbit.zip&theID=165.  Then you can paste that into an image area

Or, view your chart in Excel, select the chart and copy it (or press Alt+PrtSc to copy the Excel window) to the clipboard and paste into something like IrfanView: http://www.irfanview.com

It's really not the easiest thing in the world to do in VB...

LVL 16

Expert Comment

ID: 12432442
Actually, thanks to the miracle that is the Excel Object, you can do this quite nicely as a VBA macro.  The following will export to a gif file, given the filename to export to and the Chart name (must be a separate Chart -- not embedded into a sheet):

    Sub ExportToGif

          Charts(InputBox("Chart sheet to export")).Export InputBox("File to create"), "GIF"

    End Sub

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question