+ Reply to Thread
Results 1 to 6 of 6

Go to the filename specified in a cell

  1. #1
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    Go to the filename specified in a cell

    Hello,

    I already have a macro that will open a file, the name of which is specified in cell A3 of my workbook (as it is subject to change). Now I just need my macro to activate the newly opened workbook at various points later on in the code. This is the code I have so far...

    Please Login or Register  to view this content.

    All I need now is to activate strFName basically, but I'm not sure of the code?

    Many thanks for your help!
    Last edited by lealea1982; 08-19-2013 at 12:05 PM.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Go to the filename specified in a cell

    One method:
    Please Login or Register  to view this content.
    alternatively:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    Re: Go to the filename specified in a cell

    Thank you for your help. I did think it'd be something as simple as that, but it doesn't seem to be working though. With the first option I get Run-time error '9': Subscript out of range. With the second I get Run-time error '424': Object required.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Go to the filename specified in a cell

    I'm a bit of a loss to be honest, only thing I can see wrong with the code I did is you need a set of brackets in the second code:
    Please Login or Register  to view this content.
    and you might need to define wbstrFname

  5. #5
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    Re: Go to the filename specified in a cell

    I'm at a loss too. If I use the 2nd option (with the brackets) it will error if the workbook is already open (which at times it may well be), but when I just want it to activate strFName it just keeps coming back with run-time error 9. It seemed like such a simple idea!

  6. #6
    Registered User
    Join Date
    10-23-2007
    Posts
    80

    Re: Go to the filename specified in a cell

    Oh, I've cracked it. It was
    Please Login or Register  to view this content.
    Thanks for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find if filename exists and update variable within the filename structure
    By Lungfish in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-18-2013, 02:42 AM
  2. Replies: 0
    Last Post: 11-01-2012, 09:28 AM
  3. Code to create a custom .csv filename with version stamp in filename
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-10-2012, 04:07 AM
  4. Replies: 3
    Last Post: 07-09-2012, 03:09 PM
  5. filename cell updated with the filename inputed in the dialogue box
    By pba.mike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-27-2007, 08:15 AM

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