Results 1 to 4 of 4
  1. #1
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245

    importing using transfer spread sheet.

    Hey,
    I am getting a compile error at the start, it says it is not defined. Here is my code:

    Code:
    Private Sub AddressInfo_Click()
    Dim fd As FileDialog
       Set fd = Application.FileDialog(msoFileDialogFilePicker)
       fd.InitialFileName = "c:\abc\*.xls*"
       fd.Show
       FileName = Application.FileDialog(msoFileDialogFilePicker).SelectedItems.Item(1)
       Dim oExcel As Object, oWb As Object
       Set oExcel = CreateObject("Excel.Application")
       Set oWb = oExcel.Workbooks.Open(FileName:=FileName, Password:="xyz")
       DoCmd.TransferSpreadsheet acImport, 8, "Address_Information", FileName, True
    End Sub
    any ideas? thanks in advance!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    I did copy/paste of code from http://support.microsoft.com/kb/288543 and it ran without error.

    The error you encounter is often triggered when a needed library reference is not selected. The referenced article doesn't mention that one needs to be selected but that is the only cause I can think of. I am just not sure which library would be needed. Which libraries do you have selected?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    14.0 object library

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    I created a new project and find that it was created with 4 libraries by default:

    Visual Basic For Applications
    Microsoft Access x.0 Object Library
    OLE Automation
    Microsoft Office x.0 Access database engine Object Library

    I had to add Microsoft Office x.0 Object Library to get the code to run.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Transferspread sheet importing some WRONG values! WHAT?!
    By qwerty1 in forum Import/Export Data
    Replies: 1
    Last Post: 06-06-2012, 01:32 PM
  2. List spread over three columns
    By Al77 in forum Reports
    Replies: 5
    Last Post: 02-29-2012, 10:45 AM
  3. Importing full excel sheet to access
    By karakal in forum Import/Export Data
    Replies: 0
    Last Post: 03-22-2010, 03:48 PM
  4. Transfer text
    By nshaikh in forum Import/Export Data
    Replies: 0
    Last Post: 09-11-2008, 03:27 AM
  5. Importing Excel Sheet into Access dbase
    By tonystowe in forum Import/Export Data
    Replies: 0
    Last Post: 12-08-2006, 11:35 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