Quote:
checking their state also takes processing. I am not sure how much a InStr test takes more than a If LinkToPrevious = False test.
That's a good point indeed... One or the other does take time, it is pretty hard to calculate this. I would need to have a huge document (with a big number of different headers) in order to see if there is any difference!
Quote:
First of you never mentioned any text box. Second my good (sans any textbox) does not replace the whole header, only the "old stuff" string. Everything else remains.
You're right, I never mentioned any text box. It just popped up in my mind when I did a test in a document that happened to have text boxes in the header. And as a result, I have to say (why, I am not sure) that your nice procedure did delete (or, should I say, seems to delete, as I couldn't see them anymore) those text boxes. I assume (don't get me wrong, as you understand, I am quite a beginner here) that this is due to the line "oHF.Range.Select", which selects the whole header, right?
Quote:
You have users that will VERY OFTEN need to change existing headers. I say very often because if it is NOT often, then are you concerned about performance times. if it is a uncommon event, hey start it and go to lunch. Big deal.
The user will use RANDOM strings of text.
So...there is no logic behind what the string will be. Right?
One more information about what the documents are: they are translated documents and tags are added by the user in the translation software as a "comment marker". In other words, the string that is between the "tags" is something the user wants to double check later on in the final Word file. Now, why tags are chosen by the user is because there always is a risk to use an internal tag used by the translation software, that will compromise, or be confused as a "marker tag". Since the files come from different translation software (just to add to the complexity), I can't use a "fixed" tag, as it may be already used by the software (how could I guess?). I hope you get my point. Now, I assume that most of the time, tags will look similar to ## ##, #< #>, ?%$ $%? or strings like that (any combination of symbols, starting with 2 characters), since those are examples given to the users. As a side note, the editor of vbaexpress does use tags like those "QUOTES", that could be considered as "comment tags" in my situation, if you get my point.
Quote:
If any given section header is linked to the previous (same) header type in the previous section it is assumed that that header is correct and NO test of the current header content needs to be done. Really? Not sure why I am sceptical about that, but what do I know? BTW "for in the parent sections" - there is no such thing as "parent" sections
My understanding was that, in a Word file, you would have headers that are either linked to the previous one, or not linked (so new, different, headers). If the algorithm checks every single header and meets a new header, it will process it, then any consecutive linked header will be processed at the same time, right? So there is no need to process them further, since what needed to be done (tags checked/deleted) is already done...
Quote:
Somehow the user can get a search string into the procedure (although how is not stated...inputbox, the user selects some text in the document and THAT is used???), and in some manner "tags" are added to that string.
I guess that you now understand how tags are added to the file. Then, there is an interface that the user runs to select what function needs to be processed in the file, among which the procedure we are currently talking about (i.e. check and delete any "comment tag" and process the text in-between). So yes, there is an input box in which the user types tags that were used in the translation software to add comments.
Quote:
Umm, that is not a fact. First, the number of pages is completely irrelevant. You seem to think there is a header for each page. Not so. The number of pages has nothing to do with sections. Nothing. You can have a 1000 page document with ONE section, in which case the code will run pretty darn fast. Secondly a document with 100 sections will have 300 headers whether they are linked, or not. LinkToPrevious has NOTHING to do with the number of headers. Or the number of pages.
I understand that, I was only trying to give you an example of what may happen with a big document. I do see from time to time big documents myself (say 300 pages, with different sections), so I know I have to take this into account. As for stating that there is a header for each page, I was also referring to your previous statement that
Quote:
Headers ALWAYS exist. It is not possible for Headers to not exist. EVERY section ALWAYS has three headers and three footers. Always.
. Whether a header is not shown doesn't mean that it doesn't exist, so I was wondering if the code you suggested would be going through each of them, whether it is displayed or not in the file.