I made a specific Access Form that has many field with same names only the number at end changes. I have fields named "Code1", "Code2", "Code3" etc. I would like to paste the fields from Form view to Excel Cells. There is about 150 fields and I don't want to add them one by one.
I made a button that opens Excel template, and made a For loop but I am stuck. This is the idea:
Set MyXL = CreateObject("Excel.Application")
With MyXL
.Application.Visible = True
.Workbooks.Open "F:\0. Main\01.Templates\Order.xltx"
Dim broj As Variant
broj = UCase(ID)
Dim Kod As Variant
Dim Tip As Variant
Dim Kolic As Variant
For i = 1 To 30
-------> Kod = Code(i).Value
.Worksheets("Sheet1").Cells(11 + i, 2).Value = Kod
-------> Tip = Type(i).Value
.Worksheets("Sheet1").Cells(11 + i, 3).Value = Tip
-------> Tip = Qty(i).Value
.Worksheets("Sheet1").Cells(11 + i, 3).Value = Kolic
Next i
I don't know how to include FieldName + (number) in For loop