Membuat gravik tampil di userform
Membuat gravik tampil di userform cukup mudah caranya
Buatlah sebuah userform
Dan beberapa buah option buton untuk memilih type gravik
Paastekan kode berikut pada sebuat userform
Private Sub UserForm_Initialize()
Private Sub OptionButton1_Click()
Call UpdateChart(xlLineMarkers)
End Sub
Private Sub OptionButton2_Click()
Call UpdateChart(xlAreaStacked)
End Sub
Private Sub OptionButton3_Click()
Call UpdateChart(xlColumnClustered)
End Sub
Private Sub OptionButton4_Click()
Call UpdateChart(xlPie)
End Sub
Private Sub UpdateChart(chtype)
Dim currentChart As Chart
Dim Fname As String
Set currentChart = Sheets("Data").ChartObjects(1).Chart
currentChart.ChartType = chtype
Fname = Application.DefaultFilePath & Application.PathSeparator & "temp.gif"
currentChart.Export Filename:=Fname, FilterName:="GIF"
Image1.Picture = LoadPicture(Fname)
End Sub
Private Sub UserForm_Initialize()
OptionButton3.Value = True
End Sub
Selamat mencoba
silakan download link contoh dibawah ini
Gravik Userform
Membuat gravik tampil di userform cukup mudah caranya
Buatlah sebuah userform
Dan beberapa buah option buton untuk memilih type gravik
Paastekan kode berikut pada sebuat userform
Private Sub UserForm_Initialize()
Private Sub OptionButton1_Click()
Call UpdateChart(xlLineMarkers)
End Sub
Private Sub OptionButton2_Click()
Call UpdateChart(xlAreaStacked)
End Sub
Private Sub OptionButton3_Click()
Call UpdateChart(xlColumnClustered)
End Sub
Private Sub OptionButton4_Click()
Call UpdateChart(xlPie)
End Sub
Private Sub UpdateChart(chtype)
Dim currentChart As Chart
Dim Fname As String
Set currentChart = Sheets("Data").ChartObjects(1).Chart
currentChart.ChartType = chtype
Fname = Application.DefaultFilePath & Application.PathSeparator & "temp.gif"
currentChart.Export Filename:=Fname, FilterName:="GIF"
Image1.Picture = LoadPicture(Fname)
End Sub
Private Sub UserForm_Initialize()
OptionButton3.Value = True
End Sub
Selamat mencoba
silakan download link contoh dibawah ini
Gravik Userform
No comments:
Post a Comment