Tash Posted December 14, 2015 Posted December 14, 2015 Hi All I'm tryingto teach myself more about macros by looking at the macros that other people havewritten in SIMS reports. A few months ago I found out that you can view the 'hidden' macros in SIMS Report definition files by renaming the file from .RptDef to .zip, then extracting the zipped up file to reveal the excel file containing the macro. However whenI try to perform the step extracting the excel file from the zip file I get thefollowing error message. I don’tunderstand this error message - cananyone help? It does ‘extract’ an excel file but it has a size of 0 Kb…
vikpaw Posted December 15, 2015 Posted December 15, 2015 Rather than break into the file, load the report definition Reports | Import , into SIMS and then edit it. You can do a save as and then play with it. When creating a rptdef file for export there is an option to carry the template file with it, it's the template that has the macros. They must be in there if you've found them, but the best thing to do is as I said, import it and then you can open the template file and look at it alongside the rest of the report query. 1
Tash Posted December 15, 2015 Author Posted December 15, 2015 Hi Thanks very much for your reply, but how do you open the template file in SIMS?
bobsmith Posted December 15, 2015 Posted December 15, 2015 import - open up the report in sims (so it loads in excel) - "save as" using the excel save dialogue. Now open the excel file you just saved and play! 1
Tash Posted December 15, 2015 Author Posted December 15, 2015 Thanks, I'll try that again today, although I'm pretty sure the macros didn't show last time I tried.
vikpaw Posted December 15, 2015 Posted December 15, 2015 After import, go to Design Reports and open the imported report, next through the wizard and you should get to the templates screen where you can access the template from. 1
Tash Posted December 15, 2015 Author Posted December 15, 2015 Thanks, When you get to the template screen I haven't found a way of going into / editing the excel template - do you know how to do this?
vikpaw Posted December 15, 2015 Posted December 15, 2015 It should just be visible to edit template. If it's not available it might be because you can't edit the imported report. Go back to the beginning and start with a Save As, so you create a clone of it. Then try. It can be tricky, but in this case hopefully will work. Your clone should work, and allow edits, including looking at the template and worst case the one you imported will no longer work.
Tash Posted December 15, 2015 Author Posted December 15, 2015 Hi Vikpaw, thanks, it's just that I've created my own macros in SIMS reports, and have never been able to view the template or the macro code from within SIMS. Could you show me a screen shot of how to do it?
vikpaw Posted December 16, 2015 Posted December 16, 2015 (edited) Hi Vikpaw, thanks, it's just that I've created my own macros in SIMS reports, and have never been able to view the template or the macro code from within SIMS. Could you show me a screen shot of how to do it? Hi @Tash - sorry my bad, I was getting confused with other user applied templates, like RTF. Shows how long since i edited macros. It's kind of like Bob said, but in my experience, just running the report won't work as the macro itself closes the containing file and generates a new instance. So to see the macro, you need to disable macros with notification, so you get the prompt asking you to 'Enable Macro'. This will allow you to intercept the intermediate template file. This should be the one that is embedded in the template (I think it's just stored in the DMS and linked to), with a break on running macros, you should be able to catch the file and then look at the Auto_Open or whatever it's called. Similar to how you would follow the process to create your own macro enabled report. Edit: This is quite useful for editing / playing around, I think you can even debug the macro in this way, I can't remember if after disabling you can manually run parts of it. It might be that during editing, we just turned off the file close option so it would keep the original template open for you to play with, but after editing you'll want to get rid of it again so the end user doesn't have to deal with an extra empty file. Edited December 16, 2015 by vikpaw 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now