Insert Pivotcharts on User form Microsoft Excel 2013

Amin Kaveh

New Member
Joined
Jan 17, 2019
Messages
18
Hi
I want to insert some pivotcharts and charts to userform in Microsoft Excel 2013 visual basic for application.
Would you please help me on this ?
Thank you in advance.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
First you'll need to add an image control to your userform, if you haven't already done so. Then, let's say that you want to load "Chart 1" from "Sheet1" onto your image control. To do so, you can use the following code that will export a picture of your chart to a temporary file in the user's temp folder, load the picture onto the image control, and then delete that temporary file.

Code:
Private Sub CommandButton1_Click()
    
    Dim chrtObj As ChartObject
    Dim tempFile As String
    
    tempFile = Environ("temp") & "\temp.gif"
    
    Set chrtObj = Worksheets("Sheet1").ChartObjects("Chart 1")
    
    With chrtObj.Chart
        .Export Filename:=tempFile, FilterName:="GIF"
        With Me.Image1
            .Picture = LoadPicture(tempFile)
            .PictureSizeMode = fmPictureSizeModeZoom
        End With
    End With
    
    Kill tempFile
    
End Sub

Hope this helps!
 
Upvote 0
Thanks alot.
I also have a axis field button that filter the values taken by pivot chart.
How can I connect this value filter with a combobox at userform ?
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,985
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top