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 / January 2005

Tip: Looking for answers? Try searching our database.

Locking the userform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Oz Springs - 04 Jan 2005 15:25 GMT
I have a userform which opens the footer for the user to insert data then
automatically return to the main part of the document easily either using
the ³Cancel² or ³OK² button which I have created on the userform. The form
also has the automatic close and minimize buttons (on the top left for a
Mac, top right for a PC).

The footer window is different from the one where you just double-click on
the footer area - its the one which displays when you are in Normal or
Galley view.

There are several problems if the user decides to close or minimise the
userform while still in the footer. For instance if a user decides to click
on a bookmark button in the main body then the bookmark won¹t work.

How can I disable the automatic Close and Minimize buttons? Alternatively,
how can I get the bookmarks to work from the Galley view footer window?
Jay Freedman - 04 Jan 2005 16:22 GMT
Hi Oz,

AFAIK userforms on the PC don't have a Minimize button. You can trap the
Close event this way:

Private Sub UserForm_QueryClose(Cancel As Integer, _
     CloseMode As Integer)
  If CloseMode = vbFormControlMenu Then
     Cancel = True
  End If
End Sub

The help topic for the QueryClose event will tell you about the CloseMode
parameter's possible values.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> I have a userform which opens the footer for the user to insert data
> then automatically return to the main part of the document easily
[quoted text clipped - 14 lines]
> Alternatively, how can I get the bookmarks to work from the Galley
> view footer window?
Oz Springs - 04 Jan 2005 17:11 GMT
Thanks Jay
One query: where do I put this - in the userform code itself?

The template will be used on PCs, so this code is fine.

Many thanks

Oz

On 4/1/05 16:22, in article eN0Wnmn8EHA.2572@tk2msftngp13.phx.gbl, "Jay
Freedman" <jay.freedman@verizon.net> wrote:

> Hi Oz,
>
[quoted text clipped - 10 lines]
> The help topic for the QueryClose event will tell you about the CloseMode
> parameter's possible values.
Jay Freedman - 04 Jan 2005 17:33 GMT
Yes, this goes in the userform's code -- you can use the dropdowns at the
top of the code window to select Userform on the left and QueryClose on the
right to get the Sub and End Sub lines, then paste in the rest of the code.

Keep this in your bag of tricks, but not for this userform -- do use the
method Jean-Guy suggested instead.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> Thanks Jay
> One query: where do I put this - in the userform code itself?
[quoted text clipped - 21 lines]
>> The help topic for the QueryClose event will tell you about the
>> CloseMode parameter's possible values.
Oz Springs - 04 Jan 2005 19:10 GMT
Thanks Jay, I have added this to my userform anyway, and it works. I have
disabled going to the footer until after the form is finished, and this
works too. I¹ll try the other suggestions to replace this. What I¹ll have is
a truly idiot-proofed userform!

Thanks very much for your help

Oz

On 4/1/05 17:33, in article #jhR#No8EHA.3828@TK2MSFTNGP09.phx.gbl, "Jay
Freedman" <jay.freedman@verizon.net> wrote:

> Yes, this goes in the userform's code -- you can use the dropdowns at the
> top of the code window to select Userform on the left and QueryClose on the
> right to get the Sub and End Sub lines, then paste in the rest of the code.
>
> Keep this in your bag of tricks, but not for this userform -- do use the
> method Jean-Guy suggested instead.
Oz Springs - 05 Jan 2005 00:04 GMT
Thank you Jean-Guy and Jay. I was able to put my ³if² statement into the
macro Jean-Guy suggested and it works very well.

Kind regards

Oz

On 4/1/05 19:10, in article BE009ABC.1BE3%oz.springs@anywhere.com, "Oz
Springs" <oz.springs@anywhere.com> wrote:

> Thanks Jay, I have added this to my userform anyway, and it works. I have
> disabled going to the footer until after the form is finished, and this
[quoted text clipped - 14 lines]
>> Keep this in your bag of tricks, but not for this userform -- do use the
>> method Jean-Guy suggested instead.
Jean-Guy Marcil - 04 Jan 2005 17:14 GMT
Oz Springs was telling us:
Oz Springs nous racontait que :

> I have a userform which opens the footer for the user to insert data
> then automatically return to the main part of the document easily
[quoted text clipped - 14 lines]
> Alternatively, how can I get the bookmarks to work from the Galley
> view footer window?

I think you should approach this differently. You should not open the footer
window for the user to type in the text. Since you already have a dialog
box, include a text box in the dialog for the user to type the text to be
inserted in the footer, then, insert the text yourself. This way, the user
never has to deal with the footer directly.

Just my 2 cents!

Signature

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

Oz Springs - 04 Jan 2005 17:23 GMT
Hi Jean-Guy

The user uses the userform to put the text in and this text goes to a
bookmark in the footer.

Actually I have just thought of a workaround, and that is the macro does not
open the footer until the user clicks the ³OK² button then VB drops the text
in, closes the footer and back to the main body of the template  - all of
this more quickly than the eye can see (hopefully).

I¹ll just test this out, and maybe, maybe this is the solution to the
problem.

Kind regards

Oz

On 4/1/05 17:14, in article e#V9WDo8EHA.2276@TK2MSFTNGP09.phx.gbl, "Jean-Guy
Marcil" <no-spam@leaveme.alone> wrote:

> Oz Springs was telling us:
> Oz Springs nous racontait que :
[quoted text clipped - 25 lines]
>
> Just my 2 cents!
Jonathan West - 04 Jan 2005 17:42 GMT
> Hi Jean-Guy
>
[quoted text clipped - 10 lines]
> I¹ll just test this out, and maybe, maybe this is the solution to the
> problem.

You don't need to open the footer window at all. If the text is to go at a
specific bookmark, you can have a line of code something like this which
puts the text there

ActiveDocument.Bookmarks("FooterBookmark").Range.Text = Textbox1.Text

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Jean-Guy Marcil - 04 Jan 2005 18:13 GMT
Oz Springs was telling us:
Oz Springs nous racontait que :

> Hi Jean-Guy
>
[quoted text clipped - 4 lines]
> does not open the footer until the user clicks the ?OK? button then
> VB drops the text in, closes the footer and back to the main body of

Do not open the footer! Trouble ahead!
Use the range object instead:

   Dim FooterRange As Range

   Set FooterRange =
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range

Or, if you are using a bookamrk:

   Dim BookName As String
   Dim BookRange As Range

   BookName = "FootMark"

   With ActiveDocument
       Set BookRange = .Bookmarks.Item(BookName).Range
       BookRange.Text = "New text to add."

       .Bookmarks.Add BookName, BookRange
   End With

> the template  - all of this more quickly than the eye can see
> (hopefully).
[quoted text clipped - 38 lines]
>>
>> Just my 2 cents!

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.