PDA

View Full Version : Solved: hiding parts of a document, specifically tables and/or formfields



OTWarrior
12-11-2007, 06:13 AM
As the title says, is there a way to hide (so the specified section is not processed by the "graphics card") a table, or formfields, or even both together?

The problem I have (which is my drop down formfield code from previous posts) works fine on its own, but the the actual job I need it for, the screen has to refresh all of the formfields that the activewindow is currently displaying. Seeing as there are over 200 on the page where this code runs, the refresh does slow down the process, and cause minor flicker.

I have tried both making all formfields not shaded (minor speed increase, still fickers) and zooming right close to the active formfield (slower running, minor flicker still, but makes the user look like they are blind as everything is larger :rotlaugh: )

I was unable to find a .visible command for formfields, and screenupdate is too processor intensive for my purpose (it works, but causes some wierd visual effects on the screen).

Is there anything I can use? Or will the users have to put up with the flicker?

fumei
12-11-2007, 02:12 PM
Correct, there is no .Visible for formfields. No help there.

Setting the Range containing the formfields to Font.Hidden = True does not help either. It only hides from printing. It still shows on screen.

The problem is precisely what you need:

"the screen has to refresh all of the formfields that the activewindow is currently displaying"

And there it is. "the screen has to refresh"

So it does, or it does not. If it does, then that is what it does. It is all the same whether it is 1 formfield, or 200. There is no way to refresh them as a collection, ie. as ONE operation. They are refreshed individually. Unfortunately for you.

Would be nice if you could assign values to the formfields (by whatever individual logic), but refresh the document as a whole.

Sorry, I do not think this is possible. Word views each formfield as distinct, which they are, and must be.

What about making the document NOT active for a while, then making it active again. That would at least remove the flicker.

There is no way to do anything in Word that is not processed through the graphics card, although technically it is actually processed through the printer driver THEN passed to the video system.

TonyJollans
12-11-2007, 06:03 PM
Why do you need to do so much changing on the screen all at one time? 200 fields? The user enters 200 fields and then you want to change them all?

I seem to be missing something here. Can you give a bit more detail?

OTWarrior
12-12-2007, 01:16 AM
only one of the form fields it changed, but when my code runs, it has to unprotect the document and protect it again (this is crucial to the running of the code), when this happens, it refreshes the screen, and refreshes every formfield (or rather, everything that is displaying on the screen).

I was just curious to see if there was a method I had missed.

fumei: thats not a bad idea, except the people who are going to be using this document may get confused with whats happening. Plus the refresh would still happen when the document is active again. I will give it a go though :)

Looks like they will have to put up with it (which concerning I have done 50 corrects to this document for them, they can put up with it).

Thanks again for your input guys :)

OTWarrior
12-12-2007, 03:00 AM
I have just been fiddling around, and it is the header on each page that makes it flicker. More specifically, the autotext to display the page ("Page 1 of 3") and the logo of the company. These are both required for legal reasons.

any ideas why it causes such a problem?
Any ways around it? (I have fixed the page no. generation, but not the image problem)

TonyJollans
12-12-2007, 05:22 AM
I presume that it's being (unnecessarily) updated. Does it need to be a Field?

OTWarrior
12-12-2007, 05:35 AM
i don't understand, does what need to be a field?

I think I can get this working if I can hide the entire header before the code runs, and make it reappear when it finishes. I am just searching for some code now to do this.

fionabolt
12-12-2007, 09:06 AM
When you are reapplying document protection, are you setting noreset:=false?


If ActiveDocument.ProtectionType = wdNoProtection Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, NoReset:=TrueEnd If

fionabolt
12-12-2007, 09:08 AM
sorry - that all came out on one line, here is it again, but readable!


If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=TrueEnd
If

OTWarrior
12-12-2007, 09:26 AM
noReset is set to true, as otherwise all the data they inputted will be removed.

However, turns out that the logo isn't needed as the file is internal only, and if I re-do the page number generation, it works a treat.