I have been working with a Excel Macro. Here i have a form which has the following controls:
My macro form has a CommandButton which when pressed loads the settings from a text file to the controls.
However, I want the settings to load to the form atomatically as soon as the form is loaded without the need of pressing the button.
Please can someone help me in this. I am giving the macro code herewith.
Private fso As New FileSystemObject
Private strm As TextStream
Private strName As String
Private Sub Button_Click()
Private Sub GetSettings(ByVal FileName As String)
Set strm = fso.OpenTextFile(FileName, ForReading)
CheckBox1.Value = .ReadLine
CheckBox2.Value = .ReadLine
CheckBox3.Value = .ReadLine
CheckBox4.Value = .ReadLine
Option1.Value = .ReadLine
Option2.Value = .ReadLine
Thanks in advance,