PDA

View Full Version : Wrong VBA reference after save as



aamp
02-23-2015, 07:14 AM
Hello,
I have 3 .dot templates with macros (office 97-03). A costumer is using office 2007 and windows 7.
- 1st template is a main and it has a form with buttons to open a second .dot template.
- 2nd template has a form with textareas and radiobuttons etc. to fill the document which has bookmarks and through code it fills this document. When I click a print button it prints this document and calls a 3rd template and closes this document, after 3rd template do its job)
- 3rd template has to save a document from the 2nd template to a temp folder (wdTempFilePath) and then sends it by outlook.

All forms has to be modal.

Problem is that sometimes (about 1 of 50 sent mails) the 3rd template, instead of saving the 2nd template, it saves the 1st, which is completely empty, and then sends this document from the 1st template (according to vba references).

I would like to know how is it possible and if somebody knows how to solve this issue :)
Thank you for any advice.

Doug Robbins
02-24-2015, 09:08 PM
I am not sure why you have the code spread across three templates when it could probably all be in one - most likely the second one that you mention. However, without seeing the code, it is hard, if not impossible to tell you where it is going wrong.

aamp
02-26-2015, 04:29 AM
Thanks for reply. I understand it is hard to help without code. Unfortunately I cannot post it here :(
I don't know why it is like that, I've inherited it. At least the last template is a little bit redundant, so I have to try rewrite the second one(s).

Maybe I would like to ask: Is it possible to save all opened word documents? Thanks