Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
There are many reports we have to generate every month and half of them have to set freeze panel, filter, format...etc. We do it by ourself every time after we generate the report, but it is a lot of work to do. So I have write a macro for some of the report, but it is not enough to reduce the work flow.
Therefore is that any way to automatically add the macro in to the excel? Or other way can do that?
Posted

1 solution

You cannot do this directly in SSRS. but there is a work around if you wish to proceed.

1. generate your files in folder.
2. create SSIS Package and add script task.
3. write C# code to program your needs on each file.

VB
oExcel = CreateObject("Excel.Application")
oExcel.Visible = False
oBooks = oExcel.Workbooks
oBook = oBooks.Open(Dts.Variables("filePath").Value.ToString())
//Your macro here:
oExcel.Run("Yourmacro")


you can use above code as well...
 
Share this answer
 
v2
Comments
Iris Shing 19-Jan-15 1:56am    
Do you mean
Download the reports to a folder -> use an SSIS to run the macro automatically?
deepakdynamite 19-Jan-15 3:21am    
Yes Exactly !!!!!
But Run SSIS PAckage to add macro using C# Code
Iris Shing 20-Jan-15 0:57am    
gd, Thanks so much, I will try. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900