Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word- user should choose whether to use certain word or not

Status
Not open for further replies.

Tuula

Technical User
Feb 20, 2002
1
FI
Hello! :-D
My vba-skills are rusty after little (2years)pause after school, so can someone help me?!
There should be word "CONFIDENTIAL" on a top of the document, if you choose it.
It should appear on a paper like usual word will. I've tried the following code, but I'm not sure whether is it correct or in a right place.

Private Sub boxi_Click()
If boxi <> &quot; &quot; Then
boxi.Value = &quot;CONFIDENTIAL&quot;
Else
boxi.Value = &quot; &quot;
End If
End Sub
 
Help us out here Tuula. Are you saying that you have a MS Forms listbox on the document, or is the word &quot;Confidential&quot; inserted if the user presses a custom command-bar button?

Suggest that you insert a bookmark at the place where the Word would go if required, create a custom command bar button and assign code along the lines of the following, which would insert the word at desired point:

Sub Main()
Activedocument.bookmarks(&quot;BookmarkName&quot;).select
Selection.typetext text:=&quot;Confidential&quot;
End sub

This code could always be modified to the Selection.range so that it is inserted at the cursor point.

Hope that this gives you a starting point
Asjeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top