Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

The stupid question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Maxey - 14 Oct 2005 05:19 GMT
I think it has been asked and answered before, but I can't find it.

Is there any way to switch to and from and active document and an active
userform?  For example, I want work in the user form - select text in the
document (with userform still visible) - go back and work with the selected
text in the user form.

I found a oUserForm.Show False which display the userform in a manner that I
can switch back and forth but the userform is dead (i.e., just rests on the
screen looking back at me).

Thanks

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Al Borges - 14 Oct 2005 10:09 GMT
Hi Greg:

Why not place a toolbar object that'll callup the Userform?

Regards,
Al

(check out my free MS Word EMR Project, downloadable at
http://www.emrupdate.com/freestuff/alborgesmd.aspx)

>I think it has been asked and answered before, but I can't find it.
>
[quoted text clipped - 8 lines]
>
> Thanks
Helmut Weber - 14 Oct 2005 12:18 GMT
Hi Greg,

show the userform like this:

UserForm3.Show vbModeless

HTH

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Greg - 14 Oct 2005 14:12 GMT
Helmut,

Thanks.  I have this working on a small sample form and will try with
my larger project this evening.  I had tried the vbModless route last
night but couldn't keep my form showing.

I think my problem was the standard script that I use for loading and
showing a userform:

Sub Start()
Dim oFrm As UserForm1
Set oFrm = New UserForm1
Load oFrm
oFrm.Show vbModeless 'By addin vbModeless here the form wouldn't stay
open
Unload oFrm
Set oFrm = Nothing
End Sub

Sub Start()
Dim oFrm As UserForm1
Set oFrm = New UserForm1
Load oFrm
oFrm.Show vbModeless
'Unload oFrm - by stetting out this line the form stays open and works
like I want.
Set oFrm = Nothing
End Sub

I then added a Close button to the form:

Private Sub CommandButton3_Click()
Unload Me
End Sub

Is this the right way to do this sort of thing?

Thanks again.
Jean-Guy Marcil - 14 Oct 2005 14:49 GMT
Greg was telling us:
Greg nous racontait que :

> Helmut,
>
[quoted text clipped - 32 lines]
>
> Is this the right way to do this sort of thing?

When using a modeless form, control is returned immediately to the calling
Sub once the userform is shown. So, if you need to execute code based on
something the user does in the document in connection with the form content,
you have to put all that code in a separate Sub and call it from an event on
the userform.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Greg - 14 Oct 2005 14:55 GMT
JGM,

Sounds like you are saying that if I am not dead on right with the
method I am using then I am am getting close, right?

Thanks, Greg
Jean-Guy Marcil - 14 Oct 2005 16:23 GMT
Greg was telling us:
Greg nous racontait que :

> JGM,
>
> Sounds like you are saying that if I am not dead on right with the
> method I am using then I am am getting close, right?

Exactly, sorry for not being more explicit (forgot that you military type
needed clear instructions!) <g, d, r v v f>

Since all your code is doing is to show the form, I figured that you wanted
to do more otherwise it would be pointless, right ;-)
This is why I wrote about the separate Sub and stuff...

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Greg - 14 Oct 2005 16:52 GMT
Just endevouring to persevere ;-)

Actually I am fiddling around with and addin to work with bookmarks.  I
want to be able to select text in the document, enter the userform,
name the bookmark (you should now understand the reason for the
textbox1.change routine), create it, click back in the document to
select the next bit of text, back to the userform, etc.

I have always disliked the builtin dialog for inserting bookmarks plus
I want to display all bookmarks and provide UI to browse bookmarks,
redefine bookmarks, etc.

Cheers,
Jean-Guy Marcil - 14 Oct 2005 17:46 GMT
Greg was telling us:
Greg nous racontait que :

> I have always disliked the builtin dialog for inserting bookmarks plus
> I want to display all bookmarks and provide UI to browse bookmarks,
> redefine bookmarks, etc.

Looks good!

Good luck!

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.