Problem sending mail in office 2007 and windows7

M

Mike

Hi,
I have a word template which in autonew makes a mail merge and sends e-mail.
This have worked fine but now one of my customers have updated to windows7
and office 2007 and suddenly no mail is sent. I have other customers running
XP and office 2007 were it works fine. But for this client the question from
outlook is raised asking if its OK to send mail from an other application but
no mail is sent.
The code:

Sub Autonew()
Dim SQL_sats As String
Registry_Path = "HKEY_CURRENT_USER\Software\The company\Directories"
Registry_Key = "CustDocs"

Found_Path = System.PrivateProfileString(FileName:="", _
Section:=Registry_Path, Key:=Registry_Key)
If Found_Path = "" Then
Found_Path = "c:\temp\"
End If
SQL_sats = "Select * from " & Found_Path & "multistatement.txt" & "
where ((CUSTOMER_EMAIL IS NOT NULL))"
On Error GoTo PostPrint
ActiveDocument.MailMerge.DataSource.QueryString = SQL_sats
With ActiveDocument
.AttachedTemplate = ""
.SaveAs "Statement.doc", wdFormatDocument
With ActiveDocument.MailMerge
.Destination = wdSendToEmail
.MailAsAttachment = True
.MailAddressFieldName = "CUSTOMER_EMAIL"
.MailSubject = "Statement"
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
PostPrint:
On Error GoTo 0
SQL_sats = "Select * from " & Found_Path & "multistatement.txt" & " where
((CUSTOMER_EMAIL IS NULL ))"
On Error GoTo Comple
ActiveDocument.MailMerge.DataSource.QueryString = SQL_sats
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
Comple:
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dynamic Subject Line Email Merge 0
print cancel 1
Specify Criteria for Mail Merge Recipients 1
Close quit 1
merge error 5535 14
Closing mail merge template 6
earlier thread posted 5
control print 2

Top