Results 1 to 2 of 2
  1. #1
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    Use of CurrentProject.Path in export code

    I have written some code, learned from generous people on this site, to export data to specific cells in an existing excel workbook The problem I now face is that the user will have to insert the path to the excel file-I would like to just instruct them to store the xls file in the same place that they stored the mdb file. I did get a form with some code that allows the user to select the file and find the path, but it doesn't work consistently in a2007 and not what I need anyway. The code below works.

    Set oWB = oXL.Workbooks.Open("C:\Users\GG\Documents\TestingM isc\FileName.xls")



    I can't seem to find a way substitute CurrentProject.Path & "\" & FileName.xls for the actual path-I assume that I am not using quotes properly, but have given up on trying combinations. Can someone tell me how to do it?

    I am using A2007 in W7 64 bit computer.

  2. #2
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    I haven't gotten an answer on this, but since 30 people have looked at it, there seems to be some interest. After a lot of googling, I finally found a site with some code that used:
    Set oWB = oXL.Workbooks.Open(Application.CurrentProject.Path & "\FileName.xls")
    This works. Being a novice coder, I am not sure why "Application.etc" is necessary here. I have used other export code that created a new worksheet from a query and didn't use it.

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

Similar Threads

  1. parametrize file path
    By ysrini in forum Access
    Replies: 3
    Last Post: 03-01-2010, 09:37 AM
  2. How do I set a link from a saved path
    By cowboy in forum Reports
    Replies: 5
    Last Post: 02-16-2010, 12:43 PM
  3. Programming the BackEnd path
    By James3mc in forum Programming
    Replies: 6
    Last Post: 11-21-2009, 06:39 PM
  4. Using code to set export specs
    By SSylvesterSYC in forum Programming
    Replies: 0
    Last Post: 06-08-2009, 10:29 AM
  5. How get path of executing database?
    By mscertified in forum Forms
    Replies: 3
    Last Post: 11-09-2005, 03:56 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