R
RD
Hi all,
I'm back again with a legacy database problem.
I've inherited this "Contracts" database that was originally written in A97 for
Office 97. This application pops up Word docs and merges data into them so they
can be edited and mailed.
Well, our techs "upgraded" all the users to Office XP and things came to a
grinding halt. Seems the original developer hard coded the path to the Word
executable. The following is a snippet from the AfterUpdate event of a combo
box that one of the workers altered, "but just on his copy" to find the Word XP
exe.:
Case 5
'Routeslip
DocChoice = "c:\program files\moxp\office10\winword.exe " &
DLookup("[FileLocation]", "tblDocuments", "[ChoiceID]=5")
DoCmd.OutputTo acQuery, "qryPrintRouting", "MicrosoftExcel(*.xls)",
"c:\ast_rot.xls", False, ""
Call Shell(DocChoice, vbNormalFocus)
Apparently his path is different from everyone else.
As you can see, instead of basing the merge on the query she does an OutputTo
(so what;s wrong with TransferSpreadsheet?) and bases the merge on an XL file.
I tried to avoid the hard coded path using a late bound Word object but the
merged doc wouldn't update. I still can't figure out why using Shell allows the
merge to work but opening a Word object won't.
Anyway, I wrote this in a standard module to get rid of the hard coded path:
Public sAppPath As String
Function fFindWordExe() As String
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
sAppPath = objWord.Path & "\winword.exe "
objWord.Application.Quit
Set objWord = Nothing
End Function
Resulting in:
Case 5
'Routeslip
DocChoice = sAppPath & DLookup("[FileLocation]", "tblDocuments", "[ChoiceID]=5")
DoCmd.OutputTo acQuery, "qryPrintRouting", "MicrosoftExcel(*.xls)", & _
"c:\ast_rot.xls", False, ""
Call Shell(DocChoice, vbNormalFocus)
I've tested this on two machines, one running Office 97 and the other on Office
2003, and it seems to work ok ... except ... the merge no longer works in
Word97! I just get the field names where the data is supposed to go. The merge
interface is very different in Word97.
It may not matter if they were *all* upgraded to OXP but, knowing our techs,
that is fairly unlikely. Anyone have any ideas?
Much appreciated,
RD
I'm back again with a legacy database problem.
I've inherited this "Contracts" database that was originally written in A97 for
Office 97. This application pops up Word docs and merges data into them so they
can be edited and mailed.
Well, our techs "upgraded" all the users to Office XP and things came to a
grinding halt. Seems the original developer hard coded the path to the Word
executable. The following is a snippet from the AfterUpdate event of a combo
box that one of the workers altered, "but just on his copy" to find the Word XP
exe.:
Case 5
'Routeslip
DocChoice = "c:\program files\moxp\office10\winword.exe " &
DLookup("[FileLocation]", "tblDocuments", "[ChoiceID]=5")
DoCmd.OutputTo acQuery, "qryPrintRouting", "MicrosoftExcel(*.xls)",
"c:\ast_rot.xls", False, ""
Call Shell(DocChoice, vbNormalFocus)
Apparently his path is different from everyone else.
As you can see, instead of basing the merge on the query she does an OutputTo
(so what;s wrong with TransferSpreadsheet?) and bases the merge on an XL file.
I tried to avoid the hard coded path using a late bound Word object but the
merged doc wouldn't update. I still can't figure out why using Shell allows the
merge to work but opening a Word object won't.
Anyway, I wrote this in a standard module to get rid of the hard coded path:
Public sAppPath As String
Function fFindWordExe() As String
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
sAppPath = objWord.Path & "\winword.exe "
objWord.Application.Quit
Set objWord = Nothing
End Function
Resulting in:
Case 5
'Routeslip
DocChoice = sAppPath & DLookup("[FileLocation]", "tblDocuments", "[ChoiceID]=5")
DoCmd.OutputTo acQuery, "qryPrintRouting", "MicrosoftExcel(*.xls)", & _
"c:\ast_rot.xls", False, ""
Call Shell(DocChoice, vbNormalFocus)
I've tested this on two machines, one running Office 97 and the other on Office
2003, and it seems to work ok ... except ... the merge no longer works in
Word97! I just get the field names where the data is supposed to go. The merge
interface is very different in Word97.
It may not matter if they were *all* upgraded to OXP but, knowing our techs,
that is fairly unlikely. Anyone have any ideas?
Much appreciated,
RD