+ Reply to Thread
Results 1 to 4 of 4

Export Image to folder as .gif

  1. #1
    Registered User
    Join Date
    10-19-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Export Image to folder as .gif

    I have an Image Object ("ImgWorksheet") on a worksheet that I am trying to export to a folder (C:\New Item Images) as a .gif extension.

    I have tried to mimic the export chart method with no success thus far.

    This is Chart Code I need to change:

    Sub ExportChart()
    ' Export a selected chart as a picture
    Const sSlash$ = "/"
    Const sPicType$ = ".gif"
    Dim sChartName$
    Dim sPath$
    Dim sBook$
    Dim objChart As ChartObject


    On Error Resume Next
    ' Test if there are even any embedded charts on the activesheet
    ' If not, let the user know
    Set objChart = ActiveSheet.ChartObjects(1)
    If objChart Is Nothing Then
    MsgBox "No charts have been detected on this sheet", 0
    Exit Sub
    End If


    ' Test if there is a single chart selected
    If ActiveChart Is Nothing Then
    MsgBox "You must select a single chart for exporting ", 0
    Exit Sub
    End If


    Start:
    sChartName = Application.InputBox("Please Specify a name for the exported chart" & vbCr & _
    "There is no default name available" & vbCr & _
    "The chart will be saved in the same folder as this file", "Chart Export", "")

    ' User presses "OK" without entering a name
    If sChartName = Empty Then
    MsgBox "You have not entered a name for this chart", , "Invalid Entry"
    GoTo Start
    End If

    ' Test for Cancel button
    If sChartName = "False" Then
    Exit Sub
    End If

    ' If a name was given, chart is exported as a picture in the same
    ' folder location as their current file
    sBook = ActiveWorkbook.Path
    sPath = sBook & sSlash & sChartName & sPicType
    ActiveChart.Export Filename:=sPath, FilterName:="GIF"

    End Sub
    Last edited by cman_c; 12-04-2009 at 08:44 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,467

    Re: Export Image to folder as .gif

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    This may help
    http://www.andypope.info/vba/gex.htm
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-19-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Export Image to folder as .gif

    Andy, Thank you for you reply and the add-in. I was hoping there was a with to doe the export via VBA. I need to export the pictures to a folder and the all the text from the worksheet to a separate worksheet for emailing.

    This will be used by many different users and different excel versions. That is why I really need it in VBA form, so that when the user clicks the submit button, The text is transmitted to the new sheet and the picture is exported to the folder.

    Thanks Again,
    Chris

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,467

    Re: Export Image to folder as .gif

    the addin is in VBA

    Did you check the vbproject, it is not passworded.


    Please correct your first psot with regards to code tags.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1