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

export reports into one excel file

Status
Not open for further replies.

dvraggs

Technical User
Jan 30, 2002
22
US
I Wrote some vba code to do everything , but the porblem is it exports into 60 excel files I want one excel file with 60 tabs. Can any one help me.
code..
Private Sub Document_AfterRefresh()
Dim dopDoc As Document
Dim mydopRptAs Report
Dim FilterVar As DocumentVariable
Dim FilterChoices As Variant
Dim i, intNumChoices As Integer
Dim strNextValue As String


Set dopDoc = ThisDocument
Set mydopRpt= ActiveReport

' Put your variable (or query object) here
Set FilterVar = dopDoc.DocumentVariables("Cos Cd")
' find out how many resort values there are
intNumChoices = UBound(FilterVar.Values(boUniqueValues))
' collect the number of choices in a variant variable
FilterChoices = FilterVar.Values(boUniqueValues)
For i = 1 To intNumChoices
' Get the variable value
strNextValue = myFilterChoices(i)
' Duplicate Report
mydopRpt.AddComplexFilter FilterVar, &quot;=<Cos Cd>=&quot; & &quot;&quot;&quot;&quot; & strNextValue & &quot;&quot;&quot;&quot;
mydopRpt.Duplicate.Name = &quot;COS &quot; & strNextValue
' recompute the report
mydopRpt.ForceCompute
mydopRpt.ExportAsText (&quot;v:\BO TEMP\COS &quot; & strNextValue & &quot;.xls&quot;)


Next i


End Sub
 
Dunno if this is possible, cause it creates a text delimited file which can only have a single sheet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top