Hi all,
I am new here . How to solve the error above? I encountered while I tried to replace in presentation use long text. Thanks
Replace Text in Presentation:Error HRESULT E_FAIL has been returned from a call to a COM component UiPath [Studio] I saw in powerpoint it can replace but it stop working after replace and return error.
@poominkajornsakda is PowerPoint installed on your machine?
if yes then is it licensed ?
@poominkajornsakda make sure PPT is not opened while running the bot. you can kill PPT application before opening it.
also use latest version of ppt package
1 Like
I used for each to loop replace text in powerpoint its work but when I replace long text it error after replace.
poominkajornsakda:
How to solve the error above? I encountered while I tried to replace in presentation use long text. Thanks
Replace Text in Presentation:Error HRESULT E_FAIL has been returned from a call to a COM component UiPath [Studio ] I saw in powerpoint it can replace but it stop working after replace and return error.
Hi @poominkajornsakda
Try opening the file before replacing the text and consider using the BalaReva PowerPoint activities from the Community package, such as Find and Replace and Data Transformer .
These activities are more robust for handling long text replacements and may help bypass the COM error.
Also, avoid using special characters or rich formatting in the replacement text—stick to plain text whenever possible.
1 Like
Anil_G
(Anil Gorthi)
July 7, 2025, 8:19am
8
@poominkajornsakda
just to confirm when the replace string is shorter are you not getting any error?
also can you go to locals panel and show the complete exception details from there please
cheers
1 Like
@poominkajornsakda if you are using for each loop, try using some delay before replacing text
1 Like
I can replace only short text on powerpoint but cannot replace long text. I try to put delay before replace but same error on replace long text.
Anil_G
(Anil Gorthi)
July 7, 2025, 9:35am
13
@poominkajornsakda
please open exception details and show the full exception
also when you say longer does it contain line breaks or any special characters or does it span across multiple components of slide ?
cheers
cheers
1 Like
RemoteException wrapping System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at Microsoft.Office.Interop.PowerPoint.TextRange.Replace(String FindWhat,
String ReplaceWhat,
Int32 After,
MsoTriState MatchCase,
MsoTriState WholeWords)
at UiPath.Presentations.SlideOperations.ReplaceTextInTextFrameShape(String oldText,
String replacementText,
Shape shape,
Boolean matchCase,
Boolean wholeWords,
Boolean replaceAll)
at UiPath.Presentations.SlideOperations.ReplaceTextInTableShape(String oldText,
String replacementText,
Shape shape,
Boolean matchCase,
Boolean wholeWords,
Boolean replaceAll)
at UiPath.Presentations.SlideOperations.ReplaceText(String oldText,
String newText,
Boolean matchCase,
Boolean wholeWords,
Boolean replaceAll)
at UiPath.Presentations.Activities.FindAndReplaceTextInPresentation.ReplaceTextInternal(IPresentation presentation,
String oldText,
String newText,
Boolean matchCase,
Boolean wholeWordsOnly,
Boolean replaceAll)
at UiPath.Presentations.Activities.FindAndReplaceTextInPresentation.<>c__DisplayClass30_0.b__0()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread,
ExecutionContext executionContext,
ContextCallback callback,
Object state)
— End of stack trace from previous location —
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread,
ExecutionContext executionContext,
ContextCallback callback,
Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot,
Thread threadPoolThread)
— End of stack trace from previous location —
at UiPath.Presentations.Activities.FindAndReplaceTextInPresentation.ExecuteAsync(AsyncCodeActivityContext context,
CancellationToken cancellationToken)
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)
The text contains line breaks and a few special characters.
Anil_G
(Anil Gorthi)
July 7, 2025, 9:59am
15
@poominkajornsakda
can you try breakinng down the text with newline and use single lines
just try if it works if that works then we can replace using signle lines and remove remaining lines by replacing them with empty string
cheers