Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    214

    Unanswered: Please help me with this VBA Code

    Function MergeIt()
    Dim wordobj As word.Application
    Dim worddoc As word.Document

    Set wordobj = GetObject("U:\Email\Email Template 180 days AGI.doc", "Word.Document")
    objWord.Application.Visible = True
    objWord.MailMerge.OpenDataSource _
    Name:=CurrentDb.Name, _
    LinkToSource:=True, _
    Connection:="TABLE AGI_180", _
    SQLStatement:="SELECT * FROM [AGI_180]"
    objWord.MailMerge.Execute
    End Function


    Keeps saying that line one " Compile Error: User Defined Typle not Defined.

    Can someone please help.

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Make sure your microsoft word is referenced...

    Regards

  3. #3
    Join Date
    Feb 2003
    Location
    Wichita,KS
    Posts
    44
    You are not using the same object name that you defined.
    Dim wordobj As word.Application
    objWord.Application.Visible = True

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •