View Single Post
 
Old 03-31-2011, 04:15 AM
SaneMan SaneMan is offline Windows 98/ME Office 2003
Novice
 
Join Date: Jan 2011
Posts: 20
SaneMan is on a distinguished road
Default Setting focus to specific word document from UserForm

Hello

I am having some trouble with the set focus command from my userform. This userform is going to be used by a number of people in my office. They are filling in the text boxes on the userform and after they press 'ok' this pastes the values as variables into a word document the form comes from which has a list of all the different letters/correspondence we use.

At the moment when the user clicks 'ok' it sets the focus to the active document and then pastes the variables in. This works fine as long as there are no other word documents open as the active document is the word document the form comes from. However, the problem is encountered when another word document is running at the same time as it tries to paste the variables into the other word document.

I'm sure there's a way of setting the focus to a specific word document by stating the document's title somewhere in the Macro. However, even this would not be enough as the user will be naming the original word document with a specific reference number each time!

Is there any other way around this? Is there a way of setting the focus to the document that the form comes from? Or a way of making the word document a variable so the form always knows to paste the fields into this one document?

I know there's a way round it but I'm not smart enough to figure it out it seems!

Thanks a lot.
Reply With Quote