View Single Post
  #1   Report Post  
arcibald tuttle arcibald tuttle is offline
Junior Member
 
Posts: 5
Default Desperately seeking ACTIVE.WORKBOOK function for XLM

I'm trying to push the name of the document where I start running a macro so I can get back there after activating a master document to which I'm copying data.

I'm programming in XLM which is a lot like worksheet functions so I'm hoping maybe this is a place where this kind of question might be welcomed. I have gotten responses elsewhere on visual basic solutions, but I'm way down the rabbit hole in XLM already.

e.g. http://www.mrexcel.com/forum/showthr...34#post2619834

So I have tried using the ACTIVE.CELL function that, according to my Excel 2.2. manual, returns a cell reference with a workbook name as a prefix (or worksheet name, not sure which) but I can't get the evaluate tool to return that reference although I can use ACTIVE.CELL in formulas such as by selecting a cell and then making a call like:
Code:
=IF(ACTIVE.CELL100,"true value","false value")
lacking the evaluater I can't figure out what is wrong with the follow language that throws an error -- now it may be that ACTIVE.CELL is working fine, but my reference for the ACTIVATE command is in the wrong syntax, and or ACTIVATE can't handle an argument that has a cell reference as well as a workbook name.
Code:
              A
        
154 =ACTIVE.CELL()
. . .
166 =ACTIVATE(A154)
Complicating things is that back in 2.2 you couldn't have separate worksheets in the same document, so worksheet meant workbook. It is kind of disappointing that Excel didn't stick with the standard reference Document instead of Workbook.

They obviously knew that was the more universal reference because there is a DOCUMENTS() function, but that returns an alpha list of open documents, i.e. workbooks, without any indication of what is the active workbook. And I don't seem to find any THIS.DOCUMENT() or ACTIVE.DOCUMENT() function for returning the active workbook name.

There is an ACTIVATE.PREV() command, but that, unfortunately doesn't take you to the previously active document but to the previous document in the list under the WINDOW menu.

Once I find the function I'm looking for, then there is the problem of calling it. Normally you would put a name in quotes inside the function, e.g. ACTIVATE("pushedworkbook.xls") , but when you have stored the name in a Macro cell by hopefully some function that someone can identify for me, do you call it with an unquoted cell reference to the macro, e.g. ACTIVATE(A154).