Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    The header is obliterated when MS access table exports to Excel?

    When I export a table from the *.accdb files to Excel in it come out a textbook.xlx. An aalready created file with headers.



    Now everything is alright meaning that all went over. However, it obliterated my
    multiple line header during the export.

    I have it start writing at 12 row and it does. However, anything above row 12 that was there before the export
    action began is now gone.

    How do I fix this.

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Haven't tried to execute the code, but you realize that:

    Set ws = xl.ActiveWorkbook.Sheets.Add

    adds a new sheet. I suspect you'll find your header on the original sheet.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay, but I just want to preserve the headers. How can I fix it?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Use the sheet with the headers on it. Here's code from a db of mine, variables contain the file and sheet names:

    xl.Workbooks.Open (strFile)
    Set xlSheet = xl.Worksheets(strSheet)
    xlSheet.Select
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Could you elaborate a more on this. I am not sure how t use the three lines of VBA code that you gave me.

    Respectfully,

    Lou Reed

  6. #6
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    On my VBA code the lines are:

    xl.Workbooks.Open ("C:\Users\xxxxx.xxxxxx\Desktop\testbook.xlsx")
    Set ws = xl.ActiveWorkbook.Sheets.Add
    ws.Select

    my username is x'ed out.

    Now your is

    xl.Workbooks.Open (strFile)
    Set xlSheet = xl.Worksheets(strSheet)
    xlSheet.Select

    So does that mean that my definition for strFile would be :

    ("C:\Users\xxxxx.xxxxxx\Desktop\testbook.xlsx") ?

    Also what would strSheet be? sheet1?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Instead of:

    Set ws = xl.ActiveWorkbook.Sheets.Add

    try

    Set ws = xl.Worksheets("NameOfYourSheetHere")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I am including a zipped file of my changed db and a zipped copy of the excel sheet that it exports to. When I run the db program I get a subscript out of range error.
    I do not know what the are talking about. It compiles with no problem.

    Any way to fix this?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You haven't changed the sheet name to yours ("Expanded Tracker").
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I am attaching a jpeg file to point out the line of code in which the programs crashes with a subscript out of range error.

    I just do not know what os wrong with this line of code.

    Any help appreciated.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The name of the sheet in your Excel file isn't "Sheet1", he repeated.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I understand what you say, I used "Expanded Tracker" instead of "sheet1". The VBA code complied with no errors and it ran to finished with no runtime errors.

    When I checked testbook.xlxs it did not clear the header files - that is good, but it did not write anything into testbook.xlxs. So I have header files intact, but no data in the excel spreadsheet.


    It as I said ran to the finished sign, but it did not write anything? What is going on?

    The files are uploaded for your examination.


    Any help appreciated. Thanks in advance.


    Respectfully,


    Lou Reed
    Attached Files Attached Files

  13. #13
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I think that I know the issue here. I just do not know how to repair it. When I exported a table to Excel and used the Production Tracker table in MS Access everything went fine. The data went over and saved the header rows just fine.

    However, when I used the expanded superstore table it tool longer (as one would expect), it saved the header rows as I wanted. It however did not seem to write any data. I just got the textbook.xlsx file back again as it was when I started the whole process. It was as if nothing had changed.

    I now believe it works, it just does not work on the Superstore table with thousands of rows.

    That just refused to write. I am not sure why and that is my question. What is happening? How do I fix it.

    It seems whether it works or not depends on size of the table.

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  14. #14
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I need an answer to this question. Dows he expert of an Access table to Excel have a size limit? It seems to.

    Respectfully,

    Lou Reed

  15. #15
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    I am sorry to have to ask gain, but here goes:

    When exporting an MS Access table to MS Excel spreadsheet is there a size limit? There seems to be.

    If there is a size limit how do I raise it?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 08-26-2016, 12:52 PM
  2. Replies: 2
    Last Post: 04-08-2015, 12:43 PM
  3. Replies: 1
    Last Post: 03-11-2014, 09:29 AM
  4. How Access exports tables from a server
    By gg80 in forum Access
    Replies: 11
    Last Post: 11-16-2013, 06:17 PM
  5. Problem with Query exports to Excel
    By nokeefe in forum Access
    Replies: 9
    Last Post: 12-07-2011, 12:50 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
  •  
Other Forums: Microsoft Office Forums