+ Reply to Thread
Results 1 to 4 of 4

Make a MsgBox show the value of a cell in a closed workbook

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Make a MsgBox show the value of a cell in a closed workbook

    Hi, I have a problem which is really starting to bug me!!

    I cannot get a VB MsgBox to display the value of a cell in a different (Closed) workbook.

    To test yourself (really appreciate if you could try this):

    Make a new workbook on your C Drive C:\JohnCassell1.xls
    Then make another one C:\JohnCassell2.xls

    In Cell A1 of the JohnCassell2 workbook enter 99.

    Then in cell A1 of JohnCassell1 type "=" then click on cell A1 of the other workbook.

    Close that workbook.

    The formula looks like this: ='C:\[JohnCassell2.xls]Sheet1'!$A$1

    and shows a value of 99. So at least I can get a formula to show the value ok!

    Then in VB Editor try and make a MsgBox which shows the value of the cell in the closed workbook. This is my attempt...

    MsgBox C:\[JohnCassell2.xls]Sheet1'!$A$1.value

    This is what I cannot do.

    Just comes back with errors.

    Any help at all would be really appreciated.


    John

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    http://www.exceltip.com/exceltips.ph...tips&tipID=410

    http://www.j-walk.com/ss/excel/tips/tip82.htm


    here's a few sites on pulling values from closed workbooks that could give you some ideas


    http://www.erlandsendata.no/english/...dacimportwbado


    I suppose if you can link a formula then, just msgbox whatever the range of the formula is
    Last edited by davesexcel; 11-16-2006 at 06:53 AM.

  3. #3
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    C:\JohnCassell2.xls
    The formula looks like this: ='C:\[JohnCassell2.xls]Sheet1'!$A$1
    MsgBox C:\[JohnCassell2.xls]Sheet1'!$A$1.value
    John[/QUOTE]

    See if this works

    JohnCassell2.xls
    A1 = 99

    JohnCassell1.xls
    A1 = 'C:\[JohnCassell2.xls]Sheet1'!$A$1

    create this macro in JohnCassell1.xls

    Please Login or Register  to view this content.
    this seems to simple, so its probably not what your asking for!

    but i hope it helps!

    mccreaso

  4. #4
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462
    Awesome! Thanks so much Dave.

    Really Really Appreciated!!!

    Cheers

    John

+ 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