Hi there. I’m really hoping someone can help and that the solution is relatively simple.
For years, we have been using a mail merge to connect a SQL database and create file labels. Now that we have switched to Office 365, we’re getting a DDE connection error. Basically, the coding is relatively simple. The macro opens a new document, types the query:
XLODBC
1
driver= SQL Server; SERVER=…
SELECT …
It then saves this as :
ActiveDocument.SaveAs FileName:=STRMACROFILES & “NMLabels.dqy”, fileformat:=wdFormatText, _
lockcomments:=False, Password:=””, addtorecentfiles:=False, WritePassword:=””, ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, savenativepictureformat:=False, SaveFormsData:=False, saveasAOCELetter:=False, _
Encoding:=1252, InsertLineBreaks:=False, AllowSubstitutions:=False, LineEnding:=wdCRLF
ActiveDocument.SaveAs FileName:=STRMACROFILES & “NMLabels.dqy”, fileformat:=wdFormatText, _
lockcomments:=False, Password:=””, addtorecentfiles:=False, WritePassword:=””, ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, savenativepictureformat:=False, SaveFormsData:=False, saveasAOCELetter:=False, _
Encoding:=1252, InsertLineBreaks:=False, AllowSubstitutions:=False, LineEnding:=wdCRLF
I’ve tried connecting the database directly, but the SQL query is quite long and I get a different error that the string is longer than 255 characters.
I don’t know why it had to change, but is there an easy way to get the same results in Word 365? I’m hoping that maybe it’s just a matter of changing the way I save the file containing the query, but I’m having trouble finding anything on-line.
Any assistance would be very much appreciated.