Hi all,
I have nice "Master" userform that opens when the workbook starts and acts as the starting and central point for a small performance reporting application I'm writing. The userform shows 3 charts, captured as .gif and 3 command buttons that open userform for data entry, and detail reports.
The charts that are displayed on the master userform are dynamically updated through the data entry function and refreshed when the user has finished entering data.
What I want is when the user closes the data entry userform for the .gifs to be refreshed. At the moment, to do this I have code from within my data entry userform (cmd button close) that unloads the data entry form and then unloads and reloads my Master userform to process the Initialize command that captures the charts and presents them.
I'd rather just refresh the .gifs than reload the complete userform to make the process smooth and quicker.
Can anyone help out?
Here's the code:
Master Userform Initialize and Chart Presentation:
Data Entry "Close Button" Code:
Appreciate any tips/advice
Thanks
Paul
I have nice "Master" userform that opens when the workbook starts and acts as the starting and central point for a small performance reporting application I'm writing. The userform shows 3 charts, captured as .gif and 3 command buttons that open userform for data entry, and detail reports.
The charts that are displayed on the master userform are dynamically updated through the data entry function and refreshed when the user has finished entering data.
What I want is when the user closes the data entry userform for the .gifs to be refreshed. At the moment, to do this I have code from within my data entry userform (cmd button close) that unloads the data entry form and then unloads and reloads my Master userform to process the Initialize command that captures the charts and presents them.
I'd rather just refresh the .gifs than reload the complete userform to make the process smooth and quicker.
Can anyone help out?
Here's the code:
Master Userform Initialize and Chart Presentation:
Code:
Private Sub UserForm_Initialize()
ChartNum = 1
UpdateChart_OverallOEE
UpdateChart_OverallUnits
UpdateChart_OverallWeights
End Sub
Private Sub UpdateChart_OverallOEE()
Set CurrentChart = Sheets("Chart_OverallOEE").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 710
CurrentChart.Parent.Height = 150
' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "Chart_OverallOEE.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Show the chart
img_Chart_OverallOEE.Picture = LoadPicture(Fname)
End Sub
Private Sub UpdateChart_OverallUnits()
Set CurrentChart = Sheets("Chart_OverallUnits").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 700
CurrentChart.Parent.Height = 150
' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "Chart_OverallUnits.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Show the chart
img_Chart_OverallUnits.Picture = LoadPicture(Fname)
End Sub
Private Sub UpdateChart_OverallWeights()
Set CurrentChart = Sheets("Chart_OverallWeights").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 700
CurrentChart.Parent.Height = 175
' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "Chart_OverallWeights.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Show the chart
img_Chart_OverallWeights.Picture = LoadPicture(Fname)
End Sub
Data Entry "Close Button" Code:
Code:
Private Sub cmd_Close_Click()
Application.Calculate
ActiveWorkbook.RefreshAll
Public_Modify = 0
Public_TimeOn = 0
Public_TimeOff = 0
Public_TimeDiff = 0
Public_QtyActivity = 0
Public_TurnOnEnter = 0
Unload CellDataEntry
Unload Master
Master.Show
Appreciate any tips/advice
Thanks
Paul