So I was on vacation yesterday, and I come back only to find that Access 2003 has been installed on my computer... :-<
At first I thought that there would be only the stupid warnings at startup to worry about (which there are) but it appears that some of my code is incompatible with 2003. This code is to run a mail merge preparing form letters for the day's leads in the database. The red is where Access is choking. Any advice on this one? Any help would vastly improve my day, which is off to a miserable start.
Thanks a lot,
Alex
It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
At first I thought that there would be only the stupid warnings at startup to worry about (which there are) but it appears that some of my code is incompatible with 2003. This code is to run a mail merge preparing form letters for the day's leads in the database. The red is where Access is choking. Any advice on this one? Any help would vastly improve my day, which is off to a miserable start.
Code:
Public Function MailMergeMemo()
Dim WordFileTemplateName As String
Dim WordFileOutputName As String
If Weekday(Date) <> 2 Then 'Is today's date Monday ?
WordFileTemplateName = _
"pathname\file.doc"
Else 'Include Seeds on Monday
WordFileTemplateName = _
"pathname\file.doc"
End If
WordFileOutputName = Format(Date - 1, "mmddyy") & "file.doc"
Set appword = CreateObject("word.application")
appword.Visible = True
appword.Documents.Open WordFileTemplateName
With ActiveDocument.MailMerge
[COLOR=red].Destination = wdSendToNewDocument[/color]
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ChangeFileOpenDirectory _
"pathname"
ActiveDocument.SaveAs filename:=WordFileOutputName, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
appword.Quit (False) 'without saving
' appword.Documents("filename.doc").Close
' DoCmd.Quit 'quit access driver file
End Function
Thanks a lot,
Alex
It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.