This is the entire code for a button. It's was auto-converted from macro to script via Access.
Code:
Private Sub Command19_Click()On Error GoTo Command19_Click_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="OpenRulesForm" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><Statements><Action Name="OpenForm"><Argument Name="FormName">Rules List
' _AXL:ing Form</Argument></Action></Statements></UserInterfaceMacro>
DoCmd.OpenQuery "MailMerge", acViewNormal, acReadOnly
DoCmd.OutputTo acOutputQuery, "MailMerge", "ExcelWorkbook(*.xlsx)", "MailMerge.xlsx", False, "", , acExportQualityPrint
DisplayAlerts = False
Call Shell("winword.exe /f ""InitialClaimTemplate.docx""", 1)
Exit Sub
Command19_Click_Exit:
Exit Sub
Command19_Click_Err:
MsgBox Error$
Resume Command19_Click_Exit
DisplayAlerts = True
End Sub
Once I get the error that word can no longer find the template file, I re-save the database using the old fashion method of File, Save As and overWriting the database file I'm working in. Then when I click on the Buttons everything works again. I'm leaving the database open all the time, so I'm wondering if the auto-save or something like that is messing up the path name?? I can close the Database and re-open it but the buttons still won't work again until I Re-save using the Save As in the File Menu.