![]() |
|
|
|
#1
|
|||
|
|||
|
Hello All, I have the following code in a UserForm and it works perfectly on the Developer (my) machine: Code:
Private Sub CashANDCreditButton_Click()
Dim WD As Word.Document
Set WD = ActiveDocument
txtPO = POField.Text
txtFacility = FacilityField.Text
txtCity = CityField.Text
txtST = STField.Text
txtCreditAmount = CreditAmountField.Text
txtCashAmount = CashAmountField.Text
txtLocation = LocationField.Text
Set WD = ActiveDocument
With WD
.SelectContentControlsByTag("POTag").Item(1).Range.Text = txtPO
.SelectContentControlsByTag("FacilityTag").Item(1).Range.Text = txtFacility
.SelectContentControlsByTag("CityTag").Item(1).Range.Text = txtCity
.SelectContentControlsByTag("STTag").Item(1).Range.Text = txtST
.SelectContentControlsByTag("CashAmountTag").Item(1).Range.Text = "$" & txtCashAmount & " CASH and "
.SelectContentControlsByTag("CreditAmountTag").Item(1).Range.Text = "$" & txtCreditAmount & " CREDIT"
.SelectContentControlsByTag("LocationTag").Item(1).Range.Text = txtLocation
End With
Unload Me
End Sub
Private Sub CashButton_Click()
Dim WD As Word.Document
Set WD = ActiveDocument
txtPO = POField.Text
txtFacility = FacilityField.Text
txtCity = CityField.Text
txtST = STField.Text
txtCashAmount = CashAmountField.Text
txtLocation = LocationField.Text
Set WD = ActiveDocument
With WD
.SelectContentControlsByTag("POTag").Item(1).Range.Text = txtPO
.SelectContentControlsByTag("FacilityTag").Item(1).Range.Text = txtFacility
.SelectContentControlsByTag("CityTag").Item(1).Range.Text = txtCity
.SelectContentControlsByTag("STTag").Item(1).Range.Text = txtST
.SelectContentControlsByTag("CashAmountTag").Item(1).Range.Text = "$" & txtCashAmount
.SelectContentControlsByTag("CreditAmountTag").Item(1).Range.Text = ""
.SelectContentControlsByTag("LocationTag").Item(1).Range.Text = txtLocation
End With
Unload Me
End Sub
Private Sub ClearButton_Click()
POField.Text = ""
FacilityField.Text = ""
CityField.Text = ""
STField.Text = ""
LocationField.Text = ""
CashAmountField.Text = ""
CreditAmountField.Text = ""
End Sub
Private Sub CreditButton_Click()
Dim WD As Word.Document
Set WD = ActiveDocument
txtPO = POField.Text
txtFacility = FacilityField.Text
txtCity = CityField.Text
txtST = STField.Text
txtCreditAmount = CreditAmountField.Text
txtLocation = LocationField.Text
Set WD = ActiveDocument
With WD
.SelectContentControlsByTag("POTag").Item(1).Range.Text = txtPO
.SelectContentControlsByTag("FacilityTag").Item(1).Range.Text = txtFacility
.SelectContentControlsByTag("CityTag").Item(1).Range.Text = txtCity
.SelectContentControlsByTag("STTag").Item(1).Range.Text = txtST
.SelectContentControlsByTag("CreditAmountTag").Item(1).Range.Text = "$" & txtCreditAmount & " CREDIT"
.SelectContentControlsByTag("CashAmountTag").Item(1).Range.Text = ""
.SelectContentControlsByTag("LocationTag").Item(1).Range.Text = txtLocation
End With
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim WD As Word.Document
Set WD = ActiveDocument
POField.Text = WD.SelectContentControlsByTag("POTag").Item(1).Range.Text
FacilityField.Text = WD.SelectContentControlsByTag("FacilityTag").Item(1).Range.Text
CityField.Text = WD.SelectContentControlsByTag("CityTag").Item(1).Range.Text
STField.Text = WD.SelectContentControlsByTag("STTag").Item(1).Range.Text
LocationField.Text = WD.SelectContentControlsByTag("LocationTag").Item(1).Range.Text
End Sub
Code:
.SelectContentControlsByTag("POTag").Item(1).Range.Text = txtPO
|
|
#2
|
||||
|
||||
|
What is the full text of the error 6124 message? Typically, it's:
Error 6124: You are not allowed to edit this section because it is protected. That suggests a couple of possibilities: 1. It's being opened from a protected location (e.g. an email attachment); or 2. You have applied editing restrictions to the document and haven't allowed 'everyone' access to the content control concerned.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
It was the exact example you provided in #1. I was quite frustrated with my users, hah!
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
FileSystemObject Compile Error: User-Defined Type Not Defined
|
gsrikanth | Excel Programming | 2 | 03-28-2022 06:32 AM |
| Forms Data Using Developer Tab | scbarton | PowerPoint | 1 | 03-15-2012 09:24 AM |
| Developer Tab not showing | merago | Office | 1 | 11-16-2010 01:45 PM |
| unable to open .RTF files in server machine from client machine | Naresh_1210 | Word | 0 | 03-12-2010 03:26 AM |
| MS Office not Currently installed for this user error 25090 | sweetczz | Office | 2 | 01-24-2006 03:24 PM |