Hello all-
Im running a macro in Word. It runs when you open the document and its a mail merge doc. I need it to find the db in the folder where the form is located...(App.Path in VB) I know its Application.Path in Word but I paced that in and im getting syntax error among others my code is below... can anyone help? Thanks!
VB Code:
Private Sub Document_Open() CommandBars("Mail Merge").Visible = True ActiveDocument.MailMerge.OpenDataSource Name:= _ [COLOR=Red]" & Application.Path & "\Tracking Data.mdb", ConfirmConversions[/COLOR]:= _ False, ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _ WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _ Connection:= _ "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data [COLOR=Red]Source=" & Application.Path & ";Mode=Read;Extended Properties="""";Jet [/COLOR] OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engin" _ , SQLStatement:="SELECT * FROM `FarmingTemp`", SQLStatement1:="", SubType _ :=wdMergeSubTypeAccess ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle End Sub




Reply With Quote