+ Reply to Thread
Results 1 to 17 of 17

Reference without writting to hdd

  1. #1
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Exclamation Reference without writting to hdd

    Hello guys,

    Is it possible to give reference Book1, without it being saved to the hdd?

    The thing is that Book1 is exported from a program with the default name of Book1. I want it to be read using another workbook that I can keep always open. And just run a macro from my workbook that reads data from Book1.

    Help?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Reference without writting to hdd

    Yes, you can save a workbook as Book1.xls ... and subsequently open it. Bit confusing for everyone, but you can do it. If a file has been exported from another program, it's already been saved to your hard disc as Book1.xls.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    The book1 generated by the program is not saved to the disk. That's why I want it to be given as reference without saving it. Can it be done?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Reference without writting to hdd

    If it's not written to the disk, where is it? And how are you currently accessing it?

  5. #5
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    Ok, I'll put it in another way.

    Can a macro from Book2.xls read data from an unsaved Book1 file?

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reference without writting to hdd

    yes-refer to Workbooks("book1")
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  7. #7
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    Quote Originally Posted by JosephP View Post
    yes-refer to Workbooks("book1")
    Can you please offer an example of code I must use?

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reference without writting to hdd

    that was it.
    Please Login or Register  to view this content.
    if you want something more specific. ;-)

  9. #9
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    Quote Originally Posted by JosephP View Post
    that was it.
    Please Login or Register  to view this content.
    if you want something more specific. ;-)
    But this code must be placed in the Book1. I want it to be used using the existing Book2.xls. If I use it in Book2.xls it doesn't work returning Subscript out of Range.

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reference without writting to hdd

    Quote Originally Posted by DorianGrim View Post
    But this code must be placed in the Book1.
    no-it will work in any workbook as long as the Book1 file is open in the same instance of Excel.

  11. #11
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    Quote Originally Posted by JosephP View Post
    no-it will work in any workbook as long as the Book1 file is open in the same instance of Excel.
    Subscript out of Range.

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Reference without writting to hdd

    it will work in any workbook as long as the Book1 file is open in the same instance of Excel.

  13. #13
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    Quote Originally Posted by JosephP View Post
    it will work in any workbook as long as the Book1 file is open in the same instance of Excel.
    What do you mean by the same instance?

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Reference without writting to hdd

    This macro exists and is run from Book2.

    Please Login or Register  to view this content.
    The output is:

    Please Login or Register  to view this content.

    Both workbooks are open in the same instance of Excel. Neither workbook has been saved.


    Regards, TMS

  15. #15
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    I got it.

    Guys. Thank you very much.

  16. #16
    Registered User
    Join Date
    01-21-2012
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Reference without writting to hdd

    Quote Originally Posted by DorianGrim View Post
    I got it.

    Guys. Thank you very much.
    It appears it solved only half of the problem. Exported documents tend to behave and open like new Excel. This causes for the exported file to open in a separated window.

    Does this happen to you too:

    1. Open a saved document.
    2. Then open a new one using start/accesories/Microsoft Office/Microsoft Excel 2007

    Does it open it in a separated instance? Cause for me it does. I use Office 2007 with the option from advanced/display/Show all Windows in the Taskbar unchecked.
    Last edited by DorianGrim; 05-03-2012 at 12:37 PM.

  17. #17
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Reference without writting to hdd

    I am assuming that the third party program has produced the Book1 file and opened it in Excel.

    If that is the case, use File | Open... from within that instance of Excel to open the workbook with the code in it.

    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1