Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-09-2017, 07:20 PM
cltay87 cltay87 is offline Text Form Field & REF Field Windows 7 32bit Text Form Field & REF Field Office 2010 32bit
Novice
Text Form Field & REF Field
 
Join Date: Feb 2017
Posts: 7
cltay87 is on a distinguished road
Default


Hi Macropod, thanks for replying.

I tried adding your code into my existing code, like this :

Code:
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Data Entry (B)")
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
Dim BkMkRng As Range
objWord.Visible = True
objWord.Documents.Open "C:\Users\" & Environ("username") & "\Desktop\xxx\xxxN"
objWord.ActiveDocument.Unprotect Password:="xxx"
With objWord.ActiveDocument



.FormFields("pr1").Range.Text = ws.Range("C28").Value

 If .Bookmarks.Exists(StrBkMk) Then
    Set BkMkRng = .Bookmarks(StrBkMk).Range
    BkMkRng.Text = StrTxt
    .Bookmarks.Add StrBkMk, BkMkRng
    End If
  .Fields.Update


objWord.ActiveDocument.Protect Password:="xxx", NoReset:=False, Type:=wdAllowOnlyFormFields
End With

Set objWord = Nothing
End Sub
But fieldcode still disappear. Am I inserting the codes into wrong way?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Text Form Field & REF Field Macro to autofill a form field ONLY if the form field is blank upon entry Pindar Word VBA 2 01-12-2017 05:03 PM
Text Form Field & REF Field Insert text form field help sj80 Word 1 01-26-2016 10:50 PM
Text Form Field & REF Field Text form field in table tmarsh Word Tables 1 02-23-2015 07:43 AM
Text Form Field & REF Field Form field selection allows entry into form text box David C Word 1 10-24-2012 04:53 AM
Text Form Field & REF Field Form Fields - Create blank form text field with if statement? LAssist2011 Word 5 12-14-2011 03:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft