Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I access/amend contents of a report table using VBA

Status
Not open for further replies.

rimmer

Programmer
Jun 14, 2001
1
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top