Consulting

Results 1 to 4 of 4

Thread: VBA Code help

  1. #1
    VBAX Newbie
    Joined
    Jun 2010
    Posts
    2
    Location

    VBA Code help

    Hi

    I have a Macro where If i click a Link in access it should run the macro and attach a .txt file to the email. But I am getting the .txt file as .xls which I am unable to open. I can see the data is if i right click and open in word. How can I make it the code to attach .txt instead of .xls. Please advice ASAP.

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    Welcome to the forum.

    We can't help you without seeing the code. Be sure you wrap the code with VBA tags (click teh green VBA button). This will make the code readable and format it.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    VBAX Newbie
    Joined
    Jun 2010
    Posts
    2
    Location
    Here is the code

    Function mcrEmailPaymentsXL()
    On Error GoTo mcrEmail_Err
    Dim txtObjectName As String
    Dim txtTO As String
    Dim txtSubject As String
    Dim txtMessage As String
    txtObjectName = "Payments"
    txtTO = "xyz@abc.com "
    txtSubject = "Payments for " & Date
    txtMessage = "Attached are today's payments."
    DoCmd.SendObject acSendReport, txtObjectName, acFormatXL, txtTO, "xyz@abc.com", "", txtSubject, txtMessage, False, ""
    mcrEmail_Exit:
    Exit Function

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    You have used the output format acFormatXL, you should have used
    acFormatRTF or
    acFormatTXT

Posting Permissions

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