Is it possible to export a Graph to a Gif formatted file in Office at Mac

I intend to make a lot of complicated graphs in an Excel workbook at my Mac. As I earlier understood that Excel has a rather limited capacity for graphs in one workbook, I coded the Export method of VBA in a Sub for converting graphs into .GIF files.

When I applied this sub, as attached, to convert a graph, it gave no .GIF output file, whereas I checked that the FileName was correct.


After that, I also tried the same Sub with Export format .PNG, which is the standard Export method at Mac, but this also did not give any output and also no error message.


I understood that the relevant Graphics Export Filters have to be installed inOffice, but I do not know how to check that, neither if these Graphic Export Filters are available for Office 365 at Mac.


Any suggestions?



Sub SaveActiveChartAsGif()


' Export active graph to file Thisworkbook.Path & "\" & ActiveChart.Name & ".GIF"


Dim Fname As String

Dim FileName As String

Dim ansmsg As Integer

If ActiveChart Is Nothing Then

ansmsg = MsgBox("No actieve graph: no file will be exported", vbOKOnly)

Exit Sub

End If

Fname = ThisWorkbook.Path & "\" & ActiveChart.Name & ".GIF"

ansmsg = MsgBox("Full name of exported file = " & Fname, vbOKOnly)

ActiveChart.Export FileName = Fname, Filtername:="GIF"

ansmsg = MsgBox("FileNaam = " & FileName, vbOKOnly)

End Sub


MacBook Air 13″, macOS 10.12

Posted on Jun 3, 2024 3:02 PM

Reply
3 replies

Jun 4, 2024 7:29 AM in response to Rudegar

Thanks Rudegar for your suggestion.


Of cours, I thought of taking screenshots, but it concerns a separate workbook for each month, and each workbook for a month has worksheets for all days of that month. For each worksheet a number of calculations have been programmed to analyse the data of the day plus a Sub for setting up a chart which shows the results of that day.

As Excel has a limited amount of memory for chart data, I decided that it is better to convert these charts of the day into graphical files, which can be uploaded in the relevant day sheet.


Doing all that work by hand for all day-sheets of a year is a lot of work. That is why I was looking for the Export method of VBA.


Having read your suggestion of taking screenshots, I checked if VBA can be of help in making a screenshot of the chart at each worksheet, but when recording my actions during making a screenshot of a graph, much to my regret, I found that VBA recorded nothing of the Key combinations and the rage selection needed for making a screenshot.

My conclusion, your suggestion is not relevant in this case.

Anyhow, thanks of your suggestion and hopefully anybody can give a suggestion which solves my question about the VBA Export facility for graphical files.

Is it possible to export a Graph to a Gif formatted file in Office at Mac

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.