Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21100

how to Replace the Text in Word document using userform

$
0
0
hi to all

am new to this forum, i am create user form in word template to insert data in particular place only.

I have to create offer letter,when ever new joiner is come just i will open word template and give the particulars and when i click the submit the data is inserted.

i have inset the data in word document. but i can'nt overwrite the text.

when i want insert new data in word template, the data is inserting before the text, the previous text is not deleted. i am using MSword-2013

here is my code
Code:

Private Sub CommandButton1_Click()
Dim Name As Range
Set Name = ActiveDocument.Bookmarks("GreetName").Range
Name.Text = Me.Gname.Value

Dim Address As Range
Set Address = ActiveDocument.Bookmarks("ToAdd").Range
Address.Text = Me.Taddress.Value

Dim dt As Range
Set dt = ActiveDocument.Bookmarks("Date").Range
dt.Text = Me.TDate.Value

Dim Ref As Range
Set Ref = ActiveDocument.Bookmarks("Ref").Range
Ref.Text = Me.TRef.Value

Dim Posi As Range
Set Posi = ActiveDocument.Bookmarks("Position").Range
Posi.Text = Me.CPosition.Value

Dim CTCF As Range
Set CTCF = ActiveDocument.Bookmarks("CTCfig").Range
CTCF.Text = Me.CTCFig.Value

Dim CTCW As Range
Set CTCW = ActiveDocument.Bookmarks("CTCText").Range
CTCW.Text = Me.CTCWord.Value

Thanks for advance

Viewing all articles
Browse latest Browse all 21100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>