03-14-2014, 11:26 PM
I am still a big confused about the differences between vbscript and vba (and not very good at either!).
BUT, I did get this script working as a VBA macro enabled within the document template itself:
I would rather drive this from QM so I don't have to do a screen GUI-driving multi-sep process e.g. run doc filepath, wait for doc, activate doc, send key 'AF8, Select Macro in Word macro combo box, key 'Y to select, print doc, close doc, etc.
Much easier and safer if I can just use QM to drive steps through VB (even better with doc set to visible = false).
If I try to run the above script using VBsExec, I get errors like this:
which I think reflects the difference between vba and vb?
Thanks for any additional thoughts,
S
BUT, I did get this script working as a VBA macro enabled within the document template itself:
Sub FieldInserter()
Dim cc As ContentControl
Open "C:\Name.txt" For Input As #1
Input #1, ShortText
Close #1
NameString = ShortText
Open "C:\Date.txt" For Input As #2
Input #2, ShortText
Close #2
DateString = ShortText
For Each cc In ActiveDocument.ContentControls
If cc.Title = "NameField" Then
cc.Range.Text = NameString
End If
If cc.Title = "DateField" Then
cc.Range.Text = DateString
End If
Next cc
End SubI would rather drive this from QM so I don't have to do a screen GUI-driving multi-sep process e.g. run doc filepath, wait for doc, activate doc, send key 'AF8, Select Macro in Word macro combo box, key 'Y to select, print doc, close doc, etc.
Much easier and safer if I can just use QM to drive steps through VB (even better with doc set to visible = false).
If I try to run the above script using VBsExec, I get errors like this:
Quote:Error (RT) in Macro44: Expected end of statement
VBScript(2,8): Dim cc As ContentControl.
which I think reflects the difference between vba and vb?
Thanks for any additional thoughts,
S
