Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Search Search
Search for:
Tech Support Guy > > >

Hiding lines in a word document


(!)

JWhitehead's Avatar
JWhitehead   (Jenn) JWhitehead is offline
Computer Specs
Member with 151 posts.
THREAD STARTER
 
Join Date: Aug 2002
Location: Canada
Experience: Intermediate
11-Jul-2012, 02:43 PM #1
Hiding lines in a word document
Hello.

I am using MS Office 2007.

We are trying to setup what we are calling a "Visual Schedule". What this will do is display what is to be manufactured this week, and what the status of it is. It is possible it could be one product to be produced in a day, or it could be multi products. What I've setup is a form in word that will display the info, and do calculations.

I am having some troubles though. What we are looking to do, is let's say, for example, that on Monday there are 3 products to be made then all 3 lines would show. Then on Tuesday only 1 product is scheduled to be made. We want it so that on Monday all the lines show, and then Tuesday only 1 line shows.

I have found a way to do this, and it works at the time of saving the document. However, when the document is opened again, the "hidden" lines show again.

In the form, it has different things that are captured for each product to be made - Part #, Description, Colour (drop down), Print (drop), WO#, # of parts scheduled to be made, a running total, and status of the product. Then at the end of the row, I have a check box. At this time, if the check box is checked, then the next line shows, but if the check box is not checked, the next line hides.

The file is modified in MS Word, but is set as a webpage to be displayed. This way it can automatically cycle through 7 different machine schedules.

When the file is opened, and the first field is selected, it seems to be making all the calculated fields font size 11, rather than leaving as size 1 if it is hidden.

I am using a combination of “legacy tools” and new tools – text boxes and check boxes are legacy fields, drop downs & dates are new form fields.

I am open to suggestions that might help us get the results we are looking for.

The code to do this, which I've done, is:
Sub Check1()
docUnprotect 'runs a procedure lower down

If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
Down1Big 'runs a procedure farther down
Else
Down1Small 'runs a procedure farther down
End If

docProtect 'runs a procedure farther down
End Sub

Sub Down1Big()

‘move to the right 3, then select the next 11 spaces, change the font size to 11
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.MoveRight Unit:=wdCharacter, Count:=11, Extend:=wdExtend
Selection.Font.Size = 11
Selection.Font.ColorIndex = wdAuto

‘change the font color to white for the check box so that it isn’t visible on the HTML version
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.ColorIndex = wdWhite
End Sub

Sub Down1Small()

‘move to the right, then select the next 11 spaces, change the font size to 1 (to hide) and color to white
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.MoveRight Unit:=wdCharacter, Count:=11, Extend:=wdExtend
Selection.Font.Size = 1
Selection.Font.ColorIndex = wdWhite
End Sub

Sub docUnprotect()
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
End If
End Sub

Sub docProtect()
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset = False
End Sub
Attached Files
File Type: zip StationA TESTING.zip (22.7 KB, 4 views)
JWhitehead's Avatar
JWhitehead   (Jenn) JWhitehead is offline
Computer Specs
Member with 151 posts.
THREAD STARTER
 
Join Date: Aug 2002
Location: Canada
Experience: Intermediate
11-Jul-2012, 03:06 PM #2
Just as an FYI - it seems to work fine if not saved as HTML. If it is saved as DOCM, I can close, open, and the rows stay the size I want them to.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑