+ Reply to Thread
Results 1 to 10 of 10

Get the file name of the opened file

  1. #1
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Post Get the file name of the opened file

    Hi,

    I have an excel macro which is running good.

    I want to get the file name of the other excel file which is open already and to get activate.
    This is what I want as an extension to already existing macro.

    Ex: SLA.xlsm is the file in which macro already exists.
    ABC.xls is the file which is already open. (ABC.xls may change sometimes, the name is just for an example and always the name changes from ABC to any thing).

    Now While I am running the macro iin SLA.xlsm at some stage it should get the filename ABC.xls and ABC.xls to be activate.

    I hope I am clear.

    Is it possible..?

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

    Re: Get the file name of the opened file

    While running the macro only those Two Files are kept open?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Get the file name of the opened file

    Yes. That's correct. Only these two files are open.
    In-fact the other file which is open, I am getting it from a folder using the latest file to be open through a macro.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

    Re: Get the file name of the opened file

    Just add this piece of code to activate the next Open Window
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Get the file name of the opened file

    Getting error: Subscript out of range.. Runtime error 9

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

    Re: Get the file name of the opened file

    Don't Try It with ONE open workbook

    Add error handler in that case to show a msg saying "One Workbook is Active At the moment "

  7. #7
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Get the file name of the opened file

    I didn't understand that. I am sorry. Not an expert in coding.

    I am giving the code which I am using, Please help me correcting it..
    Please Login or Register  to view this content.

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

    Re: Get the file name of the opened file

    Just keep both the files open and try the suggested code then you won't get that error

  9. #9
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Get the file name of the opened file

    I am still getting the error even both the files are open.

  10. #10
    Forum Contributor
    Join Date
    01-17-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    402

    Re: Get the file name of the opened file

    What should I do now?

+ 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