Results 1 to 9 of 9
  1. #1
    rickscr is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    21

    link to excel with chart

    I have some code that loops through some selected Excel spreadsheets, links to them, and appends the data from sheet1 to my table. The problem is that sometimes the Excel files have a chart object that gets it's own sheet. When this happens, I get an error in Access saying "External table is not in the expected format."

    How can I get around this?



    Here's the code where I have the problem:
    Code:
    DoCmd.TransferSpreadsheet acLink, , "Temporary", path, True

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    so you don't want to do anything with those sheets that have charts on them, right? if that is so, could you maybe check the name of the sheet? I noticed that your first sheet in the picture is the default name that excel gives to one when you create a chart. do all of your chart sheets have names like that? if so, just check the sheet name in your loops and skip the ones that have charts.

  3. #3
    rickscr is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    21
    I don't care about the chart-sheet. I only want to import Sheet1.
    Yes, all of the charts will be named Chart1.

    How can I skip the sheet, but not the file?

    I've tried this as well:
    Code:
    DoCmd.TransferSpreadsheet acLink, , "Temporary", path, True, "Sheet1!"

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i've never used the LINK option, Rick. isn't there an arg in the transferspreadsheet method to specify a sheet name? you have that in your last post. I don't know why you're using bang (!) with it though. that needs to be taken out. It doesnt mean anything in that context.

  5. #5
    rickscr is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    21
    I've tried it with and without the "!" and the result is the same, though it apparently is required.
    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    It seems like I have the syntax right, so I don't know why it's not working.
    Last edited by rickscr; 04-25-2011 at 05:38 PM. Reason: fixed link

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    maybe the problem is the linking method?? how about an import method?? you can always use that, and get around it via one other step after that.

    that's one idea.

    I'm sorry I can't click on that link. it's broken, but that happens to me if it's required to go through an ad page first. I have the HOSTS file from mvps.org that blocks all internet ads, so clickthrough pages fail for me.

  7. #7
    rickscr is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    21
    The problem with the importing is that the column headers have special characters that Access doesn't like (degree signs). Using a link was the only way I found to get around it.

  8. #8
    rickscr is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    21
    Just to try it out, I changed the column headers and tried it with acImport, but with the same result.

  9. #9
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i dont know what to tell you rick. and I do not have time to test it for you. sorry, sir.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Link Excel to Access problem
    By gg80 in forum Access
    Replies: 1
    Last Post: 02-22-2011, 09:35 AM
  2. link between excel and ms-access
    By Bala Preetha in forum Access
    Replies: 1
    Last Post: 11-28-2010, 08:23 PM
  3. Access link to excel file
    By delkath in forum Access
    Replies: 3
    Last Post: 09-13-2010, 12:28 PM
  4. Exporting a chart to Excel?
    By hraup in forum Access
    Replies: 0
    Last Post: 08-31-2006, 12:21 PM
  5. link excel form to access table
    By data123 in forum Import/Export Data
    Replies: 6
    Last Post: 06-23-2006, 10:17 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