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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VBA. Code needed please

Status
Not open for further replies.

wadey

Programmer
Jun 6, 2006
54
GB
Hi,
I've been asked to copy and paste load of reports and rename the new pasted ones. Thing is there is hundreds. The renaming only involves changing one word in the name.

can anyone reply with a bit of code that could achieve this?

example:-
report named 'TestReport(word)one'

to be renamed to 'TestReport(newword)one'

regards

 
wadey,
A little more information please.
[ul]
[li]Are the reports in a Database? If so will they going to end up in the same database or another one?[/li]
[li]Are they external files stored in a drive/directory?[/li]
[li]Other?[/li][/ul]

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Thanks for the reply but i've managed to crack it with this code:-

the reports are in the same db.


Dim objDB As Database
Dim objCon As Container
Dim objRpt As Variant
Dim iLoop As Integer
Dim lngNoOfRpts As Long
Dim iCount As Integer

Set objDB = CurrentDb()
Set objCon = objDB.Containers("Reports")

lngNoOfRpts = objCon.Documents.Count

For iLoop = 0 To (lngNoOfRpts - 1)
Set objRpt = objCon.Documents(iLoop)
'Do some stuff on the report etc
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top