mjburgard
asked on
VBA script error
When I run the following, I get an error only when twosided = false. It runs normally when twosided = true.
Any ideas?
If xlSheet.Range("PFNumSides") = "2" Then
twosided = True
Else
twosided = False
End If
'Page cover - ink
For i = 1 To wdDoc.ContentControls.Count
If wdDoc.ContentControls(i).Title = "inks1" Then
If xlSheet.Range("PrintFoldColor").Text = "Color/Black&White" Then
wdDoc.ContentControls(i).Range.Text = "4/1"
Else
If xlSheet.Range("printFoldColor").Text = "Color" Then
If twosided = True Then
wdDoc.ContentControls(i).Range.Text = "4/4"
Else
wdDoc.ContentControls(i).Range.Text = "4/0"
End If
Exit For
Else
If twosided = True Then
wdDoc.ContentControls(i).Range.Text = "1/1"
Else
wdDoc.ContentControls(i).Range.Text = "1/0"
End If
Exit For
End If
Exit For
End If
Exit For
End If
Next
The error says "Automation error Call was rejected by callee."Any ideas?
ASKER
Thanks rob, but that is going into a microsoft word document as text. - and last night it mysteriously started working - I have no explanations at this point.
I am going to mark this as completed - but ...
I am going to mark this as completed - but ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If you read my previous comment, you will see that it just started working last night.
I still have no idea why, but I no longer have a problem if it is working.
I still have no idea why, but I no longer have a problem if it is working.
Try
wdDoc.ContentControls(i).R
Rob.