Hello, can anyone help me, I am trying to amend the contents of cells in a report using VBA, for example, say I have a table thus:
EMPLOYEE_NUMBER EMPLOYEE_AGE
12345 21
56789 45
How can I change, for example, the age of employee 56789 from 45 to 55 using VBA.
I am getting a bit lost in the object model, not helped by not having the full SDK!
I have got about this far (just to try and display the contents of a cell) and this was adapted from something else on this forum:
Dim myApp As Application
Dim myDocs As Documents
Dim myDoc As Document
Dim myReps As Reports
Dim myRep As Report
Dim mySection As SectionStructure
Dim myRepItems As ReportStructureItems
Dim myCell As CellStructure
Dim test As Variant
Set myApp = Application
Set myDocs = Application.Documents
Set myDoc = Application.Documents.Item(1)
Set myReps = ActiveDocument.Reports
Set myRep = myReps.Item(1)
Set myRepItems = myRep.Item(1)
Set myCell = myRepItems.Item(1)
test = myCell.Item(2).Item(2)
msgbox test
but I think I am way off here, it does not work.
Any help would be appreciated.
Thanks
Paul
EMPLOYEE_NUMBER EMPLOYEE_AGE
12345 21
56789 45
How can I change, for example, the age of employee 56789 from 45 to 55 using VBA.
I am getting a bit lost in the object model, not helped by not having the full SDK!
I have got about this far (just to try and display the contents of a cell) and this was adapted from something else on this forum:
Dim myApp As Application
Dim myDocs As Documents
Dim myDoc As Document
Dim myReps As Reports
Dim myRep As Report
Dim mySection As SectionStructure
Dim myRepItems As ReportStructureItems
Dim myCell As CellStructure
Dim test As Variant
Set myApp = Application
Set myDocs = Application.Documents
Set myDoc = Application.Documents.Item(1)
Set myReps = ActiveDocument.Reports
Set myRep = myReps.Item(1)
Set myRepItems = myRep.Item(1)
Set myCell = myRepItems.Item(1)
test = myCell.Item(2).Item(2)
msgbox test
but I think I am way off here, it does not work.
Any help would be appreciated.
Thanks
Paul