![]() |
Excel Report
I am trying to create an excel report from Access. I have been able t
output the query result to an excel file. But I need to use a templat for formatting. Can some one tell me how to create a template an associate it to the new excel file from Access. Also I need to use a macro to do some formatting. Where do I store th macro and how do I get the macro to run automatically when the exce file opens. Thanks in advance for any help. Sheri -- Message posted from http://www.ExcelForum.com |
Excel Report
Hi
I don't know how to do it from Access. But I have an Excel Workbook, that I prepared as Template Workbook for Reports. This Template Workbook has Sub Workbook_Open() = is called when the Template Workbook is opened. Here I do data fetching from any database and if necessary formatting. Then I remove the code from the workbook and save it under a new name. (not overwrite the template workbook with the code! Good luck Mich If interested Code Removal works like this Public Sub DeleteProjects(project As VBProject ' delete the source-code from a specific VBA-projec ' Example invocation ' DeleteProjects Application.VBE.ActiveVBProjec ' First tries to delete all Modules (Class, Form, Standard ' Then it empties undeleteable Modules (like ThisWorkbook... ' After this Sub all Source-code should be gone, but th ' calling procedure still finishes execution even after th ' source is deleted Dim VBComp As VBIDE.VBComponen Dim VBComps As VBIDE.VBComponent Set VBComps = project.VBComponent For Each VBComp In VBComp With VBComp.CodeModul .DeleteLines 1, .CountOfLine End Wit Select Case VBComp.Typ Case vbext_ct_StdModule, vbext_ct_MSForm, vbext_ct_ClassModul VBComps.Remove VBCom End Selec Next VBCom End Sub |
All times are GMT +1. The time now is 10:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com