Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
ralf
 
Posts: n/a
Default Removing redundant characters

Hi!

I'm trying to remove all redundant characters like two many spaces or
paragraph signs from a word doc.
This is my code so far:

Dim wdApp As Word.Application
Dim wdDatei As Word.Document
Try
wdApp = New Word.Application
wdDatei = wdApp.Documents.Open(txtSource.Text)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Sub
End Try
Try
With wdDatei.Range.Find
.Text = "^13^13"
.Replacement.Text = "^p"
.Forward = True
.Wrap = Word.WdFindWrap.wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wdDatei.Range.Find.Execute(Replace:=Word.WdReplace .wdReplaceAll)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
wdDatei.SaveAs(txtTarget.Text)
wdDatei.Close(Word.WdSaveOptions.wdDoNotSaveChange s)
wdApp.Quit()
wdDatei = Nothing
wdApp = Nothing
End Try´

When it gets to line
..Text = "^13^13"
it throws an exception.

I'm using Word 2000 and the Microsoft Word 9.0 Object Library.
Can anybody tell me what I'm doing wrong?
ralf

 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Other characters in a document semi Microsoft Word Help 1 June 19th 05 04:19 PM
How to insert Asia characters Andrew Microsoft Word Help 1 March 3rd 05 10:14 AM
Difficulties mail merging special characters from excel to word 20 Nondejuu Mailmerge 1 January 5th 05 01:30 PM
International characters in mail merge sandra Mailmerge 1 December 23rd 04 05:42 AM
Formatting characters Cecile Formatting Long Documents 1 December 16th 04 02:07 AM


All times are GMT +1. The time now is 12:08 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"