BusinessObjects Board

Refreshing a report through VBA

HI

I have a database say emp with empid , empname and salary.
I have to make a report which will promt me for empname and then save it as excel file.
Now if there are 20 records in database then i have to refresht the report for 20 times and pass the paramertes and save it as excel.

Is there is a way that i can do this through macro or any other solution.

thanks in advance


rajx72 (BOB member since 2006-08-02)

You can search in the forum… for VBA codes:

Following is a sample code, you can modify as per your need…

Sub Refresh_for_Each_Employee() 

Dim i as integer 
Dim j as string 

For i = 1 to 20 step 1 
    j =  'you must assign value of employee name here........
   ActiveDocument.DocumentVariables.Item("Enter Employee Name").Value = j 
    ActiveDocument.refresh 
    ActiveDocument.ExportasExcel "C:\foldername\EmployeeName"&j
Next i 
End Sub 

BO_Chief :us: (BOB member since 2004-06-06)

HI chief

thanks the reply. i will try it and let u know.

There is one problem I dont know how many records are there in the database. how can i loop through the records

thanks


rajx72 (BOB member since 2006-08-02)

Moderator: Can you lock this topic, Continuing HERE

Thanks


BO_Chief :us: (BOB member since 2004-06-06)

Done


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)