![]() |
#1
|
||||
|
||||
![]()
Hi all,
We have a program called MasterPack (old school dos style) which we generate quotes from and this picks up a quote.doc in a folder called Quotes in the C drive which is a mail merge document and populates all the fields. There are 3 files in this Quotes folder, quote.doc, QUOTE.txt, and quote.hed Recently one of my employees had his PC upgraded to a new unit and it came with Office 2007 (previously used 2003) and now we have this run time error. So what happens now is we go through the steps and then it gets to the "Opening this document will run the following SQL command" and click Yes to continue, the SQL msg comes up again (that never happened before) so we click yes again. It thinks then opens the word doc and populates the fields but then the run time error window pops up and if we choose "End" the merge fields are not populated and return to the merge field names EG. <<CustName>> etc etc. if we choose debug we get the VB window with this section highlighted in yellow WordBasic.Activate "Quote.doc" Then we close that and lose all data again. I am assuming it's something to do with 2007 and compatibility with the old quote.doc template being in 2003. can anyone confirm this and offer a simple solution or do i need to rewrite the quote.doc in Word 2007. I would like to keep it in 2003 for compatibility reasons, which reminds me when 2007 opens the template it does say "Compatibility mode" clear as mud right? ![]() thanks |
#2
|
|||
|
|||
![]()
WordBasic is from Word 95. You just need to find the equivalent in VBA.
Try replacing WordBasic.Activate "Quote.doc" with Windows("Quote.doc").Activate |
#3
|
||||
|
||||
![]()
ok thanks I'll give that a go and report back.
cheers ![]() |
#4
|
||||
|
||||
![]()
hi...I'm not sure if I'm doing something wrong but that change wouldn't stick. it stayed highlighted yellow, which i assume means it's still an error?
This is driving us mad, I guess we shold redo the template in 2007? |
#5
|
|||
|
|||
![]() Quote:
Thanks, Alex. |
#6
|
||||
|
||||
![]()
Hi Alex,
no unfortunately. still a major hassle ![]() |
#7
|
||||
|
||||
![]()
Can either of you post the sub containing the offending code? It would be easier to diagnose that way. If the sub references any external variables, please include those too.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
![]() Quote:
Masterpack creates a DDE script that tries to activate the window named "quote.doc", but it does not exist, so it fails. The solution is to modify the program QUOTE.WORD.MERGE in Masterpack so that the call to TU.DDE.EXEC.MACRO looks for the window named "quote.doc [Compatibility Mode]" A better solution would be if Office would NOT RENAME WINDOWS unexpectedly! But I would guess that's not going to happen any time soon. If anyone else in your organisation is using Word 97 or Word 2003, it will be necessary to come up with a more intelligent solution to allow for the original "quote.doc" window name to be activated. Regards, Matt. |
#9
|
||||
|
||||
![]()
Hi Matt,
Whilst it might be true in one sense that the "problem is caused by Word 2007/2010 renaming the window", the underlying cause is that MasterPack was poorly programmed so as to rely on the window name instead of relying on the document name. Your suggestion, to: Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
![]()
True enough, mine is a quick solution, not an elegant one. I'm a Unix programmer not a Windows/Office programmer, and don't have much DDE experience - I would guess that you could probably use SBXA's TU.DDE.READ function to return the window name associated with the document, and then make that window active? Or can you make a window active with a direct macro call referencing the document name?
To be fair on the original programmer of QUOTE.WORD.MERGE, he or she did write it in March 1999 and probably never considered the possibility of a "compatibility mode"! |
#11
|
||||
|
||||
![]()
Hi Matt,
If you take a look at the code I posted in #15 in this thread: https://www.msofficeforums.com/vba/7...ction-etc.html you'll see that I work with up to four documents at a time, each of which is managed via a variable and none of which I need to make active for processing purposes. The 'master' document for each set is defined and managed via: Code:
Set DocSrc = Documents.Open(FileName:=strInFold & "\" & strFile, AddTorecentFiles:=False, Visible:=False) With DocSrc ... End with
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
![]()
Hi
I came across this post when I had a very similar problem. In the end I found that if I went to Folder Options (for any folder), and the View tab. if you have it set to Hide extensions for known file types (the default) the mailings will not work, but if you take this option off, if is all fine! I don't know if this will help anyone else, but it worked for me. |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word: The document 'Filename' caused a serious error the last time ... | martincruise | Word | 0 | 02-25-2010 01:47 AM |
Runtime error 5487 - Word cannot complete the save to to file permission error | franferns | Word | 0 | 11-25-2009 05:35 AM |
Referencing Tables in Visual Basic Editor | DavidB | Word Tables | 0 | 09-21-2009 04:01 PM |
Receive error cannot open this form because an error occurred in BCM 2007 | bornhusker | Outlook | 0 | 06-01-2009 10:28 AM |
![]() |
leroytrolley | Excel | 4 | 08-22-2008 03:57 AM |