L
Legacy 381192
Guest
Hello, I need a master's help. I have a code to copy the data from a spreadsheet to a PDF. This is the code:
In CMP (Variable).I have a list of "sequential" names, how can I create an array to help me.
Example:
Currently giving this error:
Tnx alot.
Code:
Sub CommandButton1_Click()
Dim AcroApp As Acrobat.CAcroApp
Dim AcroDOC As Acrobat.CAcroPDDoc
Dim jso As Object
Dim PDFPath, PDFOut As String
Set AcroApp = CreateObject("AcroExch.App")
AcroApp.Hide
Set AcroDOC = CreateObject("AcroExch.PDDoc")
PDFPath = ThisWorkbook.Path & "\" & "S-89.pdf"
AcroDOC.Open (PDFPath)
Set jso = AcroDOC.GetJSObject
' set a field text
Dim cmp1(1 To 4) As Object
Set cmp11 = jso.getField("Name0")
Set cmp12 = jso.getField("Assistant0")
Set cmp13 = jso.getField("Date0")
Set cmp14 = jso.getField("CounselPoint0")
Dim i As Integer
For i = 1 To 4
cmp1(i).Value = Cells(i, 1).Value
Next i
PDFOut = ThisWorkbook.Path & "\" & "S-89_2.pdf"
AcroDOC.Save 1, PDFOut
AcroDOC.Close
AcroApp.Exit
Set AcroApp = Nothing
Set AcroDOC = Nothing
End Sub
In CMP (Variable).I have a list of "sequential" names, how can I create an array to help me.
Example:
For 1 to 10
Set cmp1(i).value = jso.getfield("Name" & i)
cmp1(i).Value = Cells(i, 1).Value
Currently giving this error:
Code:
cmp1(i).Value = Cells(i, 1).Value
Tnx alot.