HI, thanks very much for your reply. While I was just copying some code for you, I realised what I had done wrong. I forgot to set one of the objects. The code I have used is as follows:
Code:
'EXPORT LOOKAHEAD REPORTS TO EXCEL
Public Sub ExportLookaheads()
'locals
Dim obj As AccessObject
Dim dbs As Object
'set object
Set dbs = Application.CurrentData
'loop through and export
For Each obj In dbs.AllQueries
If Left(obj.Name, 16) = "Lookahead Report" Then
DoCmd.OutputTo ObjectType:=acOutputQuery, ObjectName:=obj.Name, OutputFormat:=acFormatXLS, OutputFile:=conRootDir & "Lookahead Reports\" & obj.Name & ".xls"
End If
Next obj
End Sub
thanks very much for your response, without it I wouldn't have been replying and may not have found the problem!
Thanks again
Patrick
Visit my site:
http://www.drybonesuk.com