+ Reply to Thread
Results 1 to 18 of 18

Runtime Error 481 Invalid Picture

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Runtime Error 481 Invalid Picture

    Hi Andy

    I'm afraid I'm a VBA Virgin, how would I go about doing this?

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

    Re: Runtime Error 481 Invalid Picture

    Alter the code slightly.

    Private Sub UpdateChart(ChartNum As Integer)
      Dim currentchart As Chart, Fname As String
        Set currentchart = Sheets("Portfolio").ChartObjects(ChartNum).Chart
        currentchart.Parent.Width = 400
        currentchart.Parent.Height = 200
    
    '   Save chart as GIF
        Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
        currentchart.Export Filename:=Fname, FilterName:="GIF"
    
    stop
    
    '   Show the chart
        Image1.Picture = LoadPicture(Fname)
    End Sub
    The stop command will pause the running program and take you to the vbe.
    Use an file explorer window to check the file size of the exported file.

    then use F5 to continue code running
    Cheers
    Andy
    www.andypope.info

+ 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