web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Populate Text fields i...
Power Automate
Unanswered

Populate Text fields in word template using script

(0) ShareShare
ReportReport
Posted on by 125

Simple Tax Invoice with Billing and Shipping - Compatibility Mode - Word 11-03-2022 16_10_15.png

i have this invoice template and i want to fill this data like business name contact number

i have to fill this template ..and my approach is using scripts will can do this and i need the best approach for this

 

i tried vb script

i used this code but this is replacing only single text i want replace multiple text

 

'declare and instaciate wrdApp
Dim wrdApp: Set wrdApp = WScript.CreateObject("Word.Application")
'declare wrdDoc
Dim wrdDoc

 

Dim wdReplaceAll

 

'Open the document
Set wrdDoc = wrdApp.Documents.Open("C:\Temp\test\test.doc")

 

'set the value for the replace "constant"
wdReplaceAll = 2

 

wrdDoc.Select

 

With wrdApp.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "aaa"
.Replacement.Text = "bbb"
.Forward = True
.Wrap = 1
.Format = False
.MatchCase = False
.MatchWholeWord = False
'the Replace argument is the 11'th argument
.Execute , , , , , , , , , , wdReplaceAll
End With

 

'clean up
Set wrdApp = Nothing
Set wrdDoc = Nothing

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 213 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 151

Last 30 days Overall leaderboard