[Solved] Help with macros
Posted: Wed Aug 19, 2015 8:03 pm
I have attached an example of what i am working on.
im having a few issues with the macros, they are normally attached to open office not the document so no matter what doc is opened the macro is ran if i can find a solution to issue 1 i dont need solutions to the other 2 issues.
issue 1. macro errors are my biggest problem. what i want to do has the macro exit sub on errors so that when there is an error it wont display my code to the user.
issue 2. I want the startup macro to only open when the document is first loaded but if i attach it to event documentloadfinished oo waits for the macro to finish before creating the view causing the macro to return an error message, if i attach it to event documentopen it doesnt load the macro at all, if i attach it to viewcreated it crashes oo when trying to go into page/print preview, so i attached it to documentactivate but it loads the macro each time the document comes back into active view. so i changed the macro around to compensate for this error, but i would like it to load each time the document is loaded instead of only the first time.
issue 3. if a doc is saved in page preview or print preview or pagebreak preview it opens up in that view causing the macros to return errors and display my macro. im working with not so smart people that freekout when this happends, i have added a check system to check doc type before loading i would also like it to check for correct view or change it to correct view but i have yet to create a macro that will close the page preview(not pagebreak preview) so the macro may read the required cells on startup.
the macros are stored on oo and not the doc because the doc is sometimes sent to another computer and when this happends macros are disabled or have errors so i have configured each computer with macros in oo that respond to the documents that are loaded.
im having a few issues with the macros, they are normally attached to open office not the document so no matter what doc is opened the macro is ran if i can find a solution to issue 1 i dont need solutions to the other 2 issues.
issue 1. macro errors are my biggest problem. what i want to do has the macro exit sub on errors so that when there is an error it wont display my code to the user.
issue 2. I want the startup macro to only open when the document is first loaded but if i attach it to event documentloadfinished oo waits for the macro to finish before creating the view causing the macro to return an error message, if i attach it to event documentopen it doesnt load the macro at all, if i attach it to viewcreated it crashes oo when trying to go into page/print preview, so i attached it to documentactivate but it loads the macro each time the document comes back into active view. so i changed the macro around to compensate for this error, but i would like it to load each time the document is loaded instead of only the first time.
issue 3. if a doc is saved in page preview or print preview or pagebreak preview it opens up in that view causing the macros to return errors and display my macro. im working with not so smart people that freekout when this happends, i have added a check system to check doc type before loading i would also like it to check for correct view or change it to correct view but i have yet to create a macro that will close the page preview(not pagebreak preview) so the macro may read the required cells on startup.
the macros are stored on oo and not the doc because the doc is sometimes sent to another computer and when this happends macros are disabled or have errors so i have configured each computer with macros in oo that respond to the documents that are loaded.