Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    18

    Unanswered: Merging to MsExcel

    Hi all;
    I am sure most of you are familiar of merging information from an access table to a word document.

    What I need to do is to merge the information from MSAccess Table into a MSExcel worksheet.

    If you have any idea on how to do this, please let me know.

    Thank you all in advance.

  2. #2
    Join Date
    Jan 2002
    Location
    At the Edge of America!
    Posts
    55
    What do you mean like a mail merge?

    The only thing I can think of is to create a vertical lookup table in excel from the data then have excel step through each record line by line.

    Not sure if that is what your looking for.

  3. #3
    Join Date
    May 2004
    Posts
    18
    I want to pick a specific record from Access table and put the information in excel worksheet for calculation.

  4. #4
    Join Date
    Jan 2002
    Location
    At the Edge of America!
    Posts
    55
    Then Cycle through the results one record at at time to print or to just have the results?

  5. #5
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Okay I can give you all the information on how to open an excel document or print one... but I dont know how to get the records in there just because I havent had the need. If you play with the code enough I am sure you will be able to figure it out.

    Here is my code to open:
    Code:
    Private Function openXLCat()
        On Error GoTo openXL_err
    Dim path As String
    
        path = "J:\Price Sheet.xls"
        Set appXL = New Excel.Application
        appXL.Visible = True
        appXL.Workbooks.Open (path)
        
        Set appXL = Nothing
        Set workXL = Nothing
    openXL_exit:
        Exit Function
    
    openXL_err:
        MsgBox Err.Description
        Resume openXL_exit
        
    End Function
    Here is the print code:
    Code:
    Private Function printXLCat()
    Dim MsgResult As VbMsgBoxResult
    MsgResult = MsgBox("Print this 4 page report?", vbYesNo, "Report Print")
    If MsgResult <> vbYes Then
        Exit Function
    End If
        On Error GoTo printXL_err
    Dim path As String
    
        path = "J:\Price Sheet.xls"
        Set appXL = New Excel.Application
        Set workXL = appXL.Workbooks.Open(path)
        workXL.PrintOut
        appXL.Quit
        Set appXL = Nothing
        Set workXL = Nothing
    printXL_exit:
        Exit Function
    
    printXL_err:
        MsgBox Err.Description
        Resume printXL_exit
        
    End Function
    Those two functions are pulled from buttons. So in the button on click event you would type =openXLCat() to open and =printXLCat() to print.

    I hope that helps,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

Posting Permissions

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