Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 04-01-2011, 01:54 AM
SaneMan SaneMan is offline Setting focus to specific word document from UserForm Windows 98/ME Setting focus to specific word document from UserForm Office 2003
Novice
Setting focus to specific word document from UserForm
 
Join Date: Jan 2011
Posts: 20
SaneMan is on a distinguished road
Default

That works perfectly! Massive thanks.

One problem though... it seems to have affected how the minimize function works on the form. We don't want the user to actual see the word document and use the form for all of the letter generation functions, so in the Initialize macro we have Word.ActiveDocument.WindowState = wdWindowStateMinimize. We also have minimize buttons on the form which minimize both the form and the word document and this is Word.ActiveWindow.WindowState - wdwindowStateMinimize.

Before I inputted your macro this worked so when we open the document it immediately loaded the userform and minimized the word document to make it inactive. It also meant when you're looking at other word documents it took the focus to them but then when you clicked on the userform document tab at the bottom it would go straight back to the userform with the 'mother' word document minimised.

Now when we load the document it still mimizes the word document correctly, but as soon as you look at another word document it maximizes the userform word document. It also stops the Minimize feature on the userform working correctly - you can click the mimize button to minimize the form, but now when you click on the tab at the bottom to re-activate the word document/userform it brings up the word document but does not re-load the userform.

Any way around this?

Many thanks again. Never would have figured it out myself!

Edit - forgot an important point. When I first made the changes you suggested and opened up the userform it did not minimize the word document. So I looked through the macros and realised Word.ActiveDocument.WindowState no longer worked. So I had to change it to Word.ActiveWindow.WindowState. Somehow adding the DocFrm as a dimension has stopped the active document window state being able to be affected. I think this is the reason when I click onto another word document it stops the userform word document from being minimized..
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook userform validation help aiwnjoo Outlook 0 12-08-2010 12:57 AM
Setting focus to specific word document from UserForm Checkbox on Userform result in Text in Word Dolfie_twee Word VBA 1 06-22-2010 07:54 AM
Create Hyperlinks from Word to specific location in PDF sukanyae Word 0 02-25-2010 04:08 PM
Help with forms (shifting focus) jrh312 Word 0 11-19-2009 12:59 PM
[Word 2003] Macro's and a UserForm xanuex Word VBA 0 10-19-2009 05:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft