Question

Microsoft Word Package - Bug Report

  • 18 August 2022
  • 2 replies
  • 134 views

For this package in the bot store: https://botstore.automationanywhere.com/bot/a2019-microsoft-word-package/p>

 

For each "Replace" action I use, it adds a carriage return to the end of the word document. Ive tried to disable all replace actions, and the carriage returns did not show. Then, I added 1 replace action, and a single return appeared at the bottom of the output word doc... when i added a 2nd replace action... 2 returns appeared at the bottom of the output word doc.

 

Is there any way to repair this or mitigate the issue?


2 replies

Userlevel 3
Badge +8

From my experience that package is not working very well...I've tried to use it on a word document that included tables and it didn't replace anything. I coded a VBS script to workaround this, hope it helps

 

Function GENERIC_TEXT_REPLACE(path,find_text,replace_text)

' Generic function to replace text in word document

' path(String): Full path of word document

' find_text(Array): Array of values to look For

' replace_text(Array): Array of values to replace

Set objWord = CreateObject("Word.Application")

objWord.Visible = False

 

Set objDoc = objWord.Documents.Open(path)

Set objSelection = objWord.Selection

 

For i = 0 to UBound(find_text)

FindText = find_text(i)

MatchCase = False

MatchWholeWord = true

MatchWildcards = False

MatchSoundsLike = False

MatchAllWordForms = False

Forward = True

Wrap = wdFindContinue

Format = False

wdReplaceNone = 0

ReplaceWith = replace_text(i)

wdFindContinue = 1

wdReaplaceAll = 2

 

a = objSelection.Find.Execute(FindText,MatchCase,MatchWholeWord,MatchWildcards,MatchSoundsLike,MatchAllWordForms,Forward,Wrap,Format,ReplaceWith,wdReaplaceAll)

Next

 

'Save the doc

objDoc.Save

objDoc.Close

objWord.Quit

 

GENERIC_TEXT_REPLACE = "Success"

 

End Function

Badge +1

I’m having exact same issues. Package itself is actually working good but the carriage return is a bit annoying. Did you find a solution to it?

Reply