Reputation: 4645
I was given a template for report (.dotm) with alot of vba code behind that gets data from a mssql database and writes the data at some bookmarks. Unfortunately, the code has an error and I have to fix it.
Since I have never done vba before, I'm a bit lost. There is a function with 2 parameters that does everything.
Can you tell me how I can debug this function? I have set a breakpoint to the first line but how can I tell word(?) to execute the function?
My first approach was to add a button and set the onclick event to this function. But unfortunately macros are disabled by our policy and this doesn't work :(
Can you please help me out how I can get inside this function?
Upvotes: 0
Views: 406
Reputation: 5385
How can anyone expect the code in the template to work if macros are disabled?
Try ALT+F11 to get into the VBA environment and show the code. Put the cursor in the code you want to debug and press F8 to step into it or F5 to run it to any breakpoint.. If the code you want to debug has parameters, you have to write a dummy Sub
to call the function with test-parameters.
Also, see sams comment about the trust center. Maybe you can change the settings yourself to allow macros.
Upvotes: 1