Get a Jumpstart with our Sample Apps
Results 1 to 5 of 5

Thread: Mail merge to an excel sheet

  1. #1
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Tampa, Florida
    Posts
    352

    Default Mail merge to an excel sheet

    Is there anyway to merge to an excel sheet that has merge data fields the same way that you can with a word doc?

  2. #2
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,212

    Default Re: Mail merge to an excel sheet

    I'm not sure what you mean by 'mail merge', but you can export your table data to an Excel spreadsheet.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  3. #3
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Tampa, Florida
    Posts
    352

    Default Re: Mail merge to an excel sheet

    I'm trying to send financial data collected to excel. I have a word doc that I use to merge the rest of the client info but can't seem to get a format that looks good with the financial info. It consists of monthly expenses. When I export to excel I just 1 row of data. Maybe Im doing it wrong. I have done this before when I first started using alpha and can't seem to remember how I did it. Do i need to create an operation or is there another way?

  4. #4
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,817

    Default Re: Mail merge to an excel sheet

    You can push data to specific col/row coordinates in excel.
    In the snippet below, we're pushing telephone number changes to an excel sheet, which is then used to populate an old legacy system.

    Code:
    dim oExcel as P
    dim oWorkbook as P
    dim fn as C
    debugcheck()
    fn = "g:\casereg\phone_change\ss_phone_changes.xls"   '<==== This would be the name of YOUR excel sheet
    oWorkbook = ole.GetObject(fn)
    oWorkbook.Application.visible = .T.
    oWorkbook.windows(1).activate()
    dim oWorksheet1 as P
    oWorksheet1 = oWorkbook.Worksheets(1)
    'determine 1st availavle row
    dim oRange as P
    oRange = oWorksheet1.Range("A1:F50")
    for row = 1 to oRange.Rows.Count
        x = oRange.cells(row,1).value
    	if alltrim(x) = ""
    		exit for
    	end if
    next row
    
    Dim colrow as C = "A"+alltrim(str(row))
    evaluate_template(a5_eval_expression("oWorksheet1.Range("+quote(colrow)+")= {YOUR FIELD1}"))
    
    colrow = "B"+alltrim(str(row))
    evaluate_template(a5_eval_expression("oWorksheet1.Range("+quote(colrow)+")= {YOUR FIELD2}"))
    
    colrow = "C"+alltrim(str(row))
    evaluate_template(a5_eval_expression("oWorksheet1.Range("+quote(colrow)+")= {YOUR FIELD3}"))
    
    colrow = "D"+alltrim(str(row))
    evaluate_template(a5_eval_expression("oWorksheet1.Range("+quote(colrow)+")= {YOUR FIELD4}"))
    
    colrow = "E"+alltrim(str(row))
    evaluate_template(a5_eval_expression("oWorksheet1.Range("+quote(colrow)+")= {YOUR FIELD5}"))
    
    
    
    colrow = "F"+alltrim(str(row))
    evaluate_template(a5_eval_expression("oWorksheet1.Range("+quote(colrow)+")= {YOUR FIELD6}"))
    
    ... AS MANY FIRELDS AS YOU MIGHT NEED
    
    'now save it
    oWorkbook.Save()
    oWorkbook.Application.visible = .F.
    oWorkbook.close()
    ...so if you know the col/row of the cells on the worksheet you want to update, just replace my "colrow" with the appropriate column and row to be filled.

    The {YOUR FIELDx} fields would be the fields from your record that you want to push to excel.

    I know this is a bit thin, but hopefully it will get you started.

    Tom

  5. #5
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Tampa, Florida
    Posts
    352

    Default Re: Mail merge to an excel sheet

    This looks a bit intimidating however I was able to create a beautiful table set on an word doc and use some fields to keep data in order.

Similar Threads

  1. Import EXCEL Spreadsheet - Having 3 Sheets. Need 3rd Sheet. Not 1st Sheet
    By SMARTII in forum Alpha Five Version 11 - Desktop Applications
    Replies: 12
    Last Post: 03-06-2015, 10:37 AM
  2. mail merge
    By Mark Pearson in forum Alpha Five Version 10 - Desktop Applications
    Replies: 4
    Last Post: 12-26-2009, 09:50 PM
  3. Mail Merge
    By gezzer1520 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 6
    Last Post: 04-28-2009, 04:46 AM
  4. Add Blank Mail Labels to top of sheet
    By carterweslock in forum Alpha Five Version 5
    Replies: 2
    Last Post: 04-29-2006, 01:40 PM
  5. Mail merge
    By Alan Lander in forum Alpha Five Version 5
    Replies: 1
    Last Post: 01-25-2004, 02:25 AM

Posting Permissions

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