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