+ Reply to Thread
Results 1 to 3 of 3

Need current Filename for macro application command

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Need current Filename for macro application command

    I made an ActiveX button to run a macro that alters more than solely the sheet it was created upon (I'm assuming that was the initial issue) it works great now, but the reference to run is set to the filename. Every time I save it as a new revision I have to edit the code.

        Application.Run "'Density Log REV.12.xls'!ThisWorkbook.dbCREATEtestable"
    Is there a way to set the filename to current in VBA without referencing a cell with

    =MID(CELL("filename"),SEARCH("[",CELL("filename"))+1, SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)
    Thank you in advance!



    Wow,
    Figured it out shortly after posting.

        Application.Run "'ThisWorkbook.dbCREATEtestable"
    take out the reference!
    Last edited by Soemd; 06-22-2013 at 02:52 PM. Reason: solved

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need current Filename for macro application command

    Thank you for posting the solution.

    In future, you can post the solution as post 2 of your thread, so others can easily identify the question from the answer.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    06-20-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Need current Filename for macro application command

    10-4 Arlu1201!

    Quote Originally Posted by Soemd View Post
    Wow,
    Figured it out shortly after posting.

        Application.Run "'ThisWorkbook.dbCREATEtestable"
    take out the reference!

+ 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