merge code no longer working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got code that transfers data to a special word document from within
access, renames it and saves and formats everything. Before my computer
crashed, everything worked perfectly. On a new computer, I naturally
re-installed office, and now some of the vb instructions in access are NOT
working. Can anyone help? I'd sure appreciate it. Thanks

Using XP Pro and Access2000
 
You most likely need to add some references that are either missing or not
active. Go into the code editor and select Tools References. Look for any
checked references indicating "Missing" and register them. If none indicate
"Missing", then you need to activate an unchecked reference. Your error
message should give you some clue to what is missing. If not, post the error
message received.
 
Thanks for your response. The problem is that I'm not receiving an error
message. The code opens a "template", renames it and saves the new file.
What used to happen was it would continue with the following code:

WApp.Selection.Find.ClearFormatting
WApp.ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle

Dim rngDocument As Object 'Range
''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

The code stops functioning before it "toggles" so it can't find the BLD in
the code. At first I thought it was a word security issue, but now I'm
completely lost!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top