Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    That is the default name given to the first sheet in a new workbook. Any others would be named Sheet2, etc. This works:



    Set ws = xl.ActiveWorkbook.Sheets("sheet1")

    Or of course you can change the sheet name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    In the attached snippet shot you can see where the code failed. I guess that it wants the db name. But it already is the
    db that i am working with So what gives here.

    I a confused. I put in the db name ImportExcel. i did not put in the extension or the path to it.the db is in the desktop.

    Do i really have to tell it where the db is since I am already using using that same db?


    Any help appreciated. Thanks i advance.

    Respectfully,

    Lou Reed
    Attached Thumbnails Attached Thumbnails Capture.GIF  

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It expects the name of the table or query you want to pull data from, not the database. I used "table1" in your sample.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Just call it table 1? That is all?

    It would seem that such a step could be hard coded in MS Access somehow?

    Thanks for your help.

    Respectfully,

    Lou Reed

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Lou, that's what YOUR table is named in the sample db you posted here. You named it that, or let a default name stand. It's not something that can be hard coded. It can be any table or query name, or SQL.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    In the attached file is a zipped Access database, an Excel file and a pdf file.


    I am curious as to why when I click the button on the form to export table1 to an Excel spreadsheet that it
    stops on the line shown in the pdf file?

    I have no stops placed in the code. Why is this happening?

    It was a line that I stopped on when I was debugging the VBA code.

    Any help appreciated. Thank in advance.

    Respectfully,

    Lou Reed
    Attached Files Attached Files

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Not sure, it doesn't happen when I test. Try Debug/Clear All Breakpoints.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Compile error next without for
    By cc.caroline15 in forum Programming
    Replies: 3
    Last Post: 03-08-2015, 01:33 PM
  2. Getting a compile error
    By alansidman in forum Programming
    Replies: 14
    Last Post: 02-11-2012, 01:12 PM
  3. Why do I get a compile error?
    By shabbaranks in forum Programming
    Replies: 24
    Last Post: 10-18-2011, 07:51 PM
  4. Program a 30-day trial into my Access Program?
    By genghiscomm in forum Programming
    Replies: 1
    Last Post: 05-26-2011, 02:14 PM
  5. new compile error!
    By darklite in forum Access
    Replies: 6
    Last Post: 09-02-2010, 05:13 PM

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