Alpha Video Training
Results 1 to 13 of 13

Thread: Excel 2003, 2007 Office Class issues, errors

  1. #1
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Excel 2003, 2007 Office Class issues, errors

    My export via AlphaDAO and my Modification code works on my system using Microsoft Excel Starter 2010 (I like using the least robust program

    to try and make sure that what I create will be compatible with whatever my clients have). The computer I am trying to get the code to work on has Excel 2007.

    I believe (correct me if wrong) that seeing the entire code is unnecessary as the errors/omissions occur prior to any code running other than the

    connections to Excel. The error in exporting is strange (only one of two sheets) as I have created code both ways using AlphaDAO export to 2003

    and 2007 Excel and the only code difference is within the connectionString.


    I tried with .xls and .xlsx
    I tried dim Doc as Office::ExcelDocument and dim Doc as Office::Excel2003Document
    above with ALL permutations...only listing the ones that are not obviously incorrect (I think!)
    '=======================================================================================
    Alpha DAO export connection:

    Excel_tbl is the variable with the full path of the file and the strings were created by Alpha and work on my system.

    connectionString = "{A5API='Excel',A5Syntax='Excel',FileName="+Excel_tbl+", A5ExcelVersion=2007}"
    OR
    connectionString = "{A5API='Excel',A5Syntax='Excel',FileName="+Excel_tbl+", A5ExcelVersion=2003}"
    '=========================================
    Excel Modification code:

    'only one of the Doc as Office::..... used of course at any given test

    dim Doc as Office::ExcelDocument 'used for 2007
    'dim Doc as Office::Excel2003Document
    dim Sheet as Office::Spreadsheet

    dim SheetName as c = ""
    SheetName=alltrim(var->sh_name) 'sh_name is the variable that has the sheet name...verified to be what is produced by the export

    'Excel_pth is a variable for the full path obtained via a function argument that has the Modification code...and is exactly the same as the AlphaDAO connection string path.

    if Doc.Load(Excel_pth)

    if Doc.FindSheet(Sheet,SheetName)

    '==================================================
    ERRORS:

    When creating .xlsx and A5ExcelVersion=2007 and using Office::Excel2003Document --well, obviously didn't (and shouldn't) work! and did not

    include the other permutations that should not work

    '--------------------------------------------------------------------------------------------------------------
    When creating .xls and A5ExcelVersion=2003 and using Office::Excel2003Document -- Only creates one sheet(instead of two) and the

    modification code brings up an error when getting to: dim Doc as Office::Excel2003Document. The error is "Type is not defined"

    '--------------------------------------------------------------------------------------------------------------

    When creating .xls and A5ExcelVersion=2007 and using Office::ExcelDocument -- Only creates one sheet(instead of two) and the modification code cannot find the SheetName....and have tried using both versions of Doc...Excel2003Document and ExcelDocument.
    But without having both sheets the Modification code is not the first concern here...just the creation of only one sheet...if this is the way to approach this issue then there are two issues most likely.

    '--------------------------------------------------------------------------------------------------------------
    When creating .xlsx and A5ExcelVersion=2007, and using Office::ExcelDocument -- goes to Doc.FindSheet(Sheet,SheetName) and does not

    find it. I have verified that the Sheet name is correct (and have used and not used alltrim() on the Sheet name. I noticed that the 2007 version has

    [Compatibility mode] as part of the spreadsheet title....and added that as well which did not help.

    This makes sense in that eliminating the Excel Modification code and opening up the Excel file an error comes up that either the file is corrupt or

    that the file extension does not match the format of the file. This appears to be the main issue and think if this is fixed that my modification code

    will work.

    '===========================================================

    One out of the last three should work....just don't know which one I should concentrate on and what to try next in any of them.


    Let me know of any additional information wanted...entire code is no problem but think it would confuse what I believe to be the main issues.
    Last edited by MikeC; 02-28-2019 at 01:55 PM.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  2. #2
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Excel 2003, 2007 Office Class issues, errors

    darn it. Mistake on issue of the second to last one:
    When creating .xls and A5ExcelVersion=2007 and using Office::ExcelDocument -- Only creates one sheet(instead of two) and the modification code cannot find the SheetName....and have tried using both versions of Doc...Excel2003Document and ExcelDocument.
    But without having both sheets the Modification code is not the first concern here...just the creation of only one sheet...if this is the way to approach this issue then there are two issues most likely.
    Should have been ....and the modification code cannot find the Doc.Load(Excel_pth) INSTEAD of "and the modification code cannot find the SheetName ". Path name definitely the same according to the debugger...and was trimmed.

    sorry about the mixup---and thought I was being careful and thorough!
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  3. #3
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Excel 2003, 2007 Office Class issues, errors

    Well,

    Narrowed down one of the issues a bit.

    The issue of not creating the two sheets (tabs) is due to some syntax that Excel 2007 does not accept or that Alpha is not doing as it is supposed to do---yet works fine on my computer.

    The sheet for the first table is created but not the second...this even happens when I reverse the order of the sheet creation so it is like the code for the second sheet is simply being ignored by either Alpha or Excel.

    The code is as follows.

    Code:
    FUNCTION Exp_SalesbyRep AS C (suffix as C="")
    ''Description:shared variable Excel_tbl is Full Path name
    
    if suffix=""
    	suffix="_"+time("yyyyMMdd__h_0m_0sam")
    end if
    
    dim shared Excel_tbl as C=""
    Excel_tbl=rtrim(var->vPath,chr(92))+chr(92)+"SalesByRep"+suffix+".xls"
    
    dim connectionString as c 
    
    connectionString = "{A5API='Excel',A5Syntax='Excel',FileName="+Excel_tbl+", A5ExcelVersion=2003}" 
    delete options 
    dim options as p 
    options.ConsolidateArguments= .t.
    options.ShowProgress= .t.
    options.AllowCancel= .f.
    options.TableNamePrefix = ""
    
    delete a_export
    dim a_export[0] as p 
    
    a_export[].LocalTableName = "sales_rep_excel.dbf"
    a_export[..].TargetTableName = "Sales_by_Rep_Summary"
    a_export[..].TargetTableOwner = ""
    a_export[..].ExportFields = "" '<<%txt%
    'Manager
    'Amount
    '%txt%
    a_export[..].Filter = ""
    a_export[..].Order = "invert(Amount)"
    a_export[..].QueryFlags = ""
    a_export[..].Arguments = ""
    a_export[..].ExportType = "Create new table"
    'CREATE TABLE sales_rep_excel
    a_export[..].CreateTableSQL = <<%txt%
    CREATE TABLE Sales_by_Rep_Summary
    (
    Manager	 text,
    Amount	 Number)%txt%
    a_export[..].DropExistingTable = "Yes"
    a_export[..].AppendFieldMap = ""
    
    a_export[].LocalTableName = "sales_cust_collection.dbf"
    a_export[..].TargetTableName = "Sales_by_Rep_Detail"
    a_export[..].TargetTableOwner = ""
    'Name
    a_export[..].ExportFields = <<%txt%
    Customer
    Job
    Txntype
    Date
    Creation_Dt
    Refnumber
    Memo
    Location
    Manager
    Item
    Amount
    %txt%
    a_export[..].Filter = "Date>=Var->vdgStart_Date.AND.Date<=Var->vdgEnd_Date"
    a_export[..].Order = "alltrim(left(Manager,100))"
    a_export[..].QueryFlags = ""
    a_export[..].Arguments = ""
    a_export[..].ExportType = "Create new table"
    
    a_export[..].CreateTableSQL = <<%txt%
    
    CREATE TABLE Sales_by_Rep_Detail
    (
    Customer	 text,
    Job	 text,
    Txntype	 text,
    [Date]	 date,
    Creation_Dt	 date,
    Refnumber	 text,
    [Memo]	 memo,
    Location	 text,
    Manager	 text,
    Item	 text,
    Amount	 Number)%txt%
    a_export[..].DropExistingTable = "Yes"
    a_export[..].AppendFieldMap = ""
    
    dim flagSilent as l
    flagSilent = .t.
    delete p 
    dim p as p 
    dim args as sql::arguments
    p = a5_AlphaDAO_Export(connectionString,a_export,options,flagSilent,args)
    
    END FUNCTION
    I have also removed the suffix variable and it made no difference. Have changed the DropExistingTable to all variations of "Yes" and "No" with no difference. I also noticed that the second sheet CreateTable fields have a tab in some of them...have removed these and makes no difference--and the debugger shows the correct syntax with just a single space between the name and the type.

    I also created a separate script that only ran the second table with a single sheet and it does not create the file....and also brings up an error that says the CreateTable is the incorrect syntax. This is the key I think but cannot see anything incorrect in the code above and the debugger shows the syntax to be the same as the first table.

    Is there anything I am missing?


    EDIT: The client is using Runtime and is the same build as what I am developing in...suppose there still could be a discrepancy between the two???
    Last edited by MikeC; 03-02-2019 at 06:34 PM. Reason: Additional possible cause
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  4. #4
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,269

    Default Re: Excel 2003, 2007 Office Class issues, errors

    Question.
    You say it works on your machine. Is that in Dev AND RT versions?
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  5. #5
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Excel 2003, 2007 Office Class issues, errors

    Hi Ted,
    It was good that you made me double check myself. For many years I always ran the Runtime patch on client's computers as part of the install...somewhere down the line I stopped and so the Runtime builds do not match. Assumptions are a programmer's nightmare. On my computer I had the same issue of only creating one sheet. Ran the Runtime patch and it fixed it on MY computer...however the patch did not cure the issue on the client's computer.

    BUT my Modification does work on the sheet that it did produce which means that I now only have the single issue of not being able to produce the second sheet.

    Thanks for your help.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  6. #6
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Excel 2003, 2007 Office Class issues, errors

    I recreated the AlphaDAO export for just the table that would not export on my development Alpha and made it into a script. When I ran it on my client's Runtime, an error was produced that showed me the issue...why no error when ran for two tables is hard to reason why. It showed that I had a missing field in the Runtime table that was being exported. Added the field and no issues.

    So apparently there were two issues...and really hard to figure out when errors are not produced!!

    I must thank you again Ted for making me double-check my Runtime version as I would not have otherwise and that is what fixed my Modification code.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  7. #7
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Excel 2003, 2007 Office Class issues, errors

    I just wanted to add one more bit of information.

    Not everyone has the issue of corruption when using ExcelDocument for .xlsx instead of using Excel2003Document for .xls but I have. It very well could have been a bug that was fixed later than the A5v11 build I have (I cannot get a higher build). The link below mentions the same thing. But due to clients still using even 2003 Excel I am glad that this issue is not the reverse...well at least until 2003 cannot be used with later Excel versions, but will cross that bridge when I come to it.

    https://forum.alphasoftware.com/show...Doc.SaveToBlob
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  8. #8
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,269

    Default Re: Excel 2003, 2007 Office Class issues, errors

    Did you put the final Patch on Mike?
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  9. #9
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Excel 2003, 2007 Office Class issues, errors

    I can only go up to v11 3381 Build 4096 so is not the latest version of v11 as that is when my ability to update ends.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  10. #10
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,269

    Default Re: Excel 2003, 2007 Office Class issues, errors

    Yes, that was the last patch.

    From the Alpha site;
    "The current Alpha Five Version 11 build is 3381_4096 (released on 22 MAR 2013 09:00 AM)."

    After that, you are into V12 if you want any upgrades to the DT. Unfortunately you get the Web "bloat" as well, so I haven't bothered.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  11. #11
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,547

    Default Re: Excel 2003, 2007 Office Class issues, errors

    From the Alpha site;
    "The current Alpha Five Version 11 build is 3381_4096 (released on 22 MAR 2013 09:00 AM)."
    I'm using Build 3788, Addins Build 4187 which was a pre-release. I believe there was a newer pre-release after that.
    I have been using 3788 for years and it has proven to be very stable.
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  12. #12
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,269

    Default Re: Excel 2003, 2007 Office Class issues, errors

    Good info Ron.
    I will explore.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  13. #13
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,269

    Default Re: Excel 2003, 2007 Office Class issues, errors

    But then again....
    The link to V11 patches has disappeared. Anyone have a clue where to get them now?

    Edit.
    Found the patch as I had downloaded but not applied it.
    Also have the RT patch, but that doesn't update the version.
    Now on 3788 as a production version, so testing an RT version using the different Dev version will be fun.

    The instructions do clearly say - in red - not to use in production. I remember asking if this was ever going to be approved, but got no reply from Alpha.
    Still if Ron is using it successfully, I will give it a go.
    Last edited by Ted Giles; 03-07-2019 at 04:03 AM.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

Similar Threads

  1. Use Office::Format class to change cell background color of an Excel cell
    By nxlcomputers in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 10-06-2016, 02:10 PM
  2. Office::Format Class Dates
    By brainwater in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 10-09-2012, 02:43 PM
  3. Office 2007 OLE
    By Bob Houle in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 05-14-2010, 10:50 AM
  4. Alpha 5 Color scheme change ala Office 2007?
    By smrogers in forum Alpha Five Version 10 - Desktop Applications
    Replies: 0
    Last Post: 03-31-2010, 05:01 PM
  5. Excel 2007 import?
    By jas102 in forum Alpha Five Version 7
    Replies: 9
    Last Post: 12-05-2007, 09:33 AM

Bookmarks

Posting Permissions

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