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.
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