TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Subject:Re: Asking for help with Word VB scripting (long) From:doc -at- edwordsmith -dot- com To:techwr-l -at- lists -dot- techwr-l -dot- com Date:Sat, 29 Apr 2006 08:57:35 -0700
On Thursday 27 April 2006 12:46, Me Too wrote the list:
<snippage>
>
> The placeholder string is supposed to indicate places
> where there may be problems.
<snippage>
> After the initial update, the code fields that check for errors
> in the stable settings do nothing but add to the time
> needed for updates.
> Doing a global search-and-replace for the visible
> placeholder strings don't work because they're
> generated by the code fields..
>
> I'm trying to make a VB script that will count the
> number of visible placeholder strings and then run the
> removal macro that number of times.
>
> Any ideas? Thanks for any help I can get.
I don't have that Word, but two ideas leapt to their figurative feet and
clowned for attention as I read your question. And heeere they are:
Idea #1: When you process the document with automation, add a few more lines
of code to finish the job by having the script write out the new version of
the document sans code. You know, use the script to also write the new
version that has the placeholder text but not the code, and give that to your
impatient users instead. E.g., instead of scanning the doc with Word/VBA
search functions, use diskfile I/O functions or VBA to process and
post-process the file in one swell foop. Take chunks of the file and parse it
as text while you look for the trigger strings. When you hit a trigger, make
the changes, then write the de-coded chunk back to the post-processed version
of the file. Programmers should knw that reading from files and writing to
files (either disk files or docs opened in Word) is the facility that makes
BASIC great. Use it to solve such problems.
Idea #2: Find the modern heir to the old WordBasic and VBA functions
expressed in the following pseudocode:
<fixtwith>
While not at the end of the document, repeat the previous search (or search
and replace) operation.
<end fixtwith>
Another thing, unless you need to know how many times the issues arose, why
count them at all?
BTW, I think I have a trace memory of something like an 'At End of Document
()' function that returmned a boolean when you tested for end of doc. It was
the old built-in Word test function to check whether your macro had reached
the bottom of the last page of a file yet or not. Documentation for it, like
soooo many VBA things in Office, is buried in Online Help under some other
topic that is at best peripheral, marginal, unsuspected, unrelated,
arbitrary, wah wah wah. Be sure to leave a trail of breadcrumbs if you
follow either of these ideas into the dark heart of online help. It may not
be a jungle, but it never gets much better than a thicket if you ask me.
MS Office/VBA newsgroups on Usenet would put you in touch with more MCPs and
woodland critters who're living this stuff than you ever wanted to hear from.
Give it a try for more variety of responses.
Good luck.
Ned Bedinger
doc -at- edwordsmith -dot- com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WebWorks ePublisher Pro for Word features support for every major Help
format plus PDF, HTML and more. Flexible, precise, and efficient content
delivery. Try it today!. http://www.webworks.com/techwr-l