Solved

How to hide Microsoft Word while at the same time displaying a user form

Posted on 2012-04-02
7
22 Views
Last Modified: 2016-04-09
Hello -  I need to know how to hide/display the body and menues of Microsoft Word (2003, 2010) and only show a user form. I have tried the Application.Visible feature, but I have onbtained different results.

Any assitance on the matter, I will be very appreciative.


Thank you,


TC
0
Comment
Question by:TonyChacon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 37795267
Visible would be my immediate response so can you define different results the better to try and help?

Chris
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 37795287
Try this code:
Sub HideAppShowForm()
    Application.Visible = False
    UserForm1.Show vbModal
    Application.Visible = True
End Sub

Open in new window

0
 

Author Comment

by:TonyChacon
ID: 37799078
Thanks Chris for your quick response.

The above code does not quite solve my need.  What I need to do is the following:

1.  Display only the user form when when Word file is open and hide everything else.
2.  I would like to display word only when the user clicks on a button.

   Here the code that I have so far:

      Private Sub chkBoxHideWord_Click()
            If chkBoxHideWord.Value = True Then
               Application.Visible = False
            Else
              Application.Visible = True
           End If
End Sub

The issue with the above code is that it does not hide the Word with all its menues.


Thanks again!
0
[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 37799549
Does not hide ... Can I ask when .... It's fine in 2003 as far as I can see, btw that was Graham's code not mine

Chris
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 37799807
I haven't had issues with menu etc being hidden, I did test an implementation and had issues with the form itself being hidden.  The following is the code in a normal I was using to launch the form:

Sub test()
    UserForm1.Show vbModeless
End Sub

Open in new window


In the form I eventually landed on:

Private Sub chkBoxHideWord_Click()
    With ThisDocument.ActiveWindow
        If chkBoxHideWord.Value = True Then
            .Visible = False
            Me.Show vbModeless
        Else
            .Visible = True
        End If
    End With
End Sub

Private Sub UserForm_Activate()
    ThisDocument.ActiveWindow.Visible = False
    Me.Show vbModeless
End Sub

Private Sub UserForm_Terminate()
    ThisDocument.ActiveWindow.Visible = True
End Sub

Open in new window


This seems to close the application from view and retain form visibility in 2003 without any issues in testing so far.

Chris
0
 
LVL 14

Expert Comment

by:frankhelk
ID: 41542649
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question