I am wanting to use the following code that I got from http://www.experts-exchange.com/Applications/MS_Office/Word/Q_20831550.html?query=Userforms+Word&clearTAFilter=true
I have a word userform with many controls that will be used to enter data for many different patients and populate bookmarks in the new. I then want to save the updated values for each of the controls to an ini (AnswerFile) file named specifically for that patient.
What I want to happen is upon opening the template, a small userform will pop up asking me to browse to the appropriate ini file that contains the most recent answers for the specific patient I am working on. When I browse to the ini file and click ok, the form closes and the main userform opens with all the controls populated with the last values saved in the ini file. Upon closing the form, the user should be prompted weather or not to save the new values of the controls into the ini file.
Here is the code I copied from the above ee expert
Private Sub CommandButton1_Click()
Dim temp As String
Dim sDesigPath As String
Dim sIniFile As String
sDesigPath = Options.DefaultFilePath(Pa
sIniFile = sDesigPath & "\Personal.ini"
, "Personal", "From") = frmFax.TextBox6
, "Personal", "Extension") = frmFax.TextBox7
, "Personal", "SenderID") = frmFax.TextBox8
1. Am I on the right track with INI files or would saving the values to another format such as XML or in the document itself be more appropriate?
2. How do I get the Values in and out of the user form? The last three lines of the above code and the temp variable have me stumped. From what I can tell the above code is assigning values to the text boxes in frmFax, but what does (sIniFile, “personal”, “From”) mean? How do I save back into the ini file?
3. How do I handle the text box to browse for the files for each name, ie C:\PatientFiles\Doe,Jane\J
i and if the file does not exist have it create a new ini file for that patient?