VB 6.0 - Saving Data from Userform to Word/Recall Userform from Word Document

Asked By Mary Sparrow on 28-Dec-11 08:13 PM

I have read several post regarding something similar to my question but still cannot figure this out.  I have created a userform with several text fields, combo list, option buttons and checkmarks.  After the userform is completed, the user presses the FINISHED button and the data from the userform is pushed to a Word document using Bookmarks

With ActiveDocument
  .Bookmark -------

Now, with the Word document showing, the user can save the Word document -- giving it a name and a folder location.

What I want to do:

1)  Since the Word document may have to be changed, I want to be able to open the Word document and once it is opened, the userform pops up and it gets populated with all the information from the Word document.  I need to do this because sometimes recalculation of numbers must be done.

2) Or is there a way to have a button on the userform ("Save & Continue Later") and once that button is clicked, it prompts the userform for a filename, then that file is created and the data is sent to that file.  And when the file is opened (whether a text file or doc file) the userform opens for more user input or editing.

I have read through numerous posts and am still unclear as how to actually set this up.  What goes in the userform_initialize section; what is attached to the "Finished" button; what code gets the userform recalled from the Word document.  I read about application.getopenfilename, but don't understand where and how to use it.  I read about instead of using bookmarks on Word Doc, use DocVariable instead but nothing shows up on Word Doc when I do that.  Please help.  I am at a total loss.  Any direction would be appreciated.

Thank, Mary
Asked By Mary Sparrow on 29-Dec-11 07:49 PM
Hi and thank you for your response.  That did not work for me.  First, I made your coding as a function.  Then I created a button that on click would run the function saveLetter.  I get error message "Argument not optional" and saveLetter is highlighted.

What I want to do is as follows:

1) Fill in fields in the userform.
2) Save data in userform
3) Push whatever data that has been entered into a user form to a Word Document.
4) Save the Word document.
4) If changes or editing is needed, I would open the SAVED Word Document and it would open the userform which is populated with the saved information.

5) I could have many saved Word documents made off the userform, but depending on which Saved Word Document I open, the userform would be populated with that information.

Often, many of the documents we prepare are the first draft and may have many revisions.  Therefore, accessing the userform with the already populated data is necessary.

Thank you