OS is XPPro, Access2002 and Word2002. Access has msword.olb library
registered. Is it possible for my access code to find a file, rename it and
save it, locate the source, and then not format the word document? A sample
of the formatting code is below. I'd really appreciate some help here.
Thanks.
WApp.Selection.Find.ClearFormatting
Dim rngDocument As Object
''Find each instance of BLD and make entire paragraph bold, then delete "BLD"
Set rngDocument = WApp.ActiveDocument.Range
With rngDocument.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "BLD"
.Forward = True
.Wrap = 0 'wdFindStop
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
While .Found
rngDocument.Paragraphs.First.Range.Font.Bold = True
rngDocument.Paragraphs.Alignment = wdAlignParagraphCenter 'my addition
for centering
rngDocument.Delete
rngDocument.MoveEnd 6 'wdStory
.Execute
Wend
End With
Hi =?Utf-8?B?QnVydEFya2lu?=,
> OS is XPPro, Access2002 and Word2002. Access has msword.olb library
> registered. Is it possible for my access code to find a file, rename it and
> save it, locate the source, and then not format the word document?
I'm not sure I understand the question (did you mistype the part about "not
format the word document"?)...
But in general terms, yes. It's not clear what you mean by "find a file", but
this sounds like you want some of the basic file management you can do in
Windows Explorer? In Office VBA, you can either use the old commands, like Dir
and Name to manipulate files. Or you can use FileSystemObject (FSO) that's part
of the Microsoft Scripting Runtime library (Tools/References).
Or are you talking about OPENING a document and using FILE/SAVE AS to give it
another name?
What do you mean by "locate the source", specifically?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
BurtArkin - 25 Dec 2005 19:04 GMT
Thanks for replying, and Happy Holidays.
The code I'm using, in Access, is supposed to locate a file (template),
merge data into it, then save it with a new name, and then perform some
formatting functions on the new Word doc. The code works on my client's
system (using Office 2003) and worked on my old machine (before it crashed)
using Office 2002. The installation on my new computer is using my
original--wait a minute!!! There's an upgrade-SP3-for Office.
I tested it and what was inexplicable is now as clear as a bell!! Thanks to
your response, I was led to an epiphany of sorts which solved my problem.
Yes, Cindy, there IS a Santa Claus. I am a very happy and rieved camper
today.

Signature
Burt
> Hi =?Utf-8?B?QnVydEFya2lu?=,
>
[quoted text clipped - 23 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 27 Dec 2005 10:08 GMT
Hi Burt
> wait a minute!!! There's an upgrade-SP3-for Office.
> I tested it and what was inexplicable is now as clear as a bell!! Thanks to
> your response, I was led to an epiphany of sorts which solved my problem.
> Yes, Cindy, there IS a Santa Claus.
Yes, you see my pointy ears :-) Glad to have made your holidays happier.
Cindy Meister