home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,360 of 10,840   
   Elef to All   
   Re: VBA and Excel - Workbook opening pro   
   28 Mar 05 14:17:33   
   
   From: m.p.b@*toglimi*rocketmail.com   
      
   The restriction applies to Subs and functions called by the function also.   
   The idea behind this restriction is that a worksheet function should never   
   have side effects.   
   Bye   
   Elef   
      
   "Peter"  ha scritto nel messaggio   
   news:j7P1e.15203$XH5.10489@fe1.news.blueyonder.co.uk...   
   > Thanks. I was not aware of this restriction.   
   > Presumably using Workbooks.Open counts as a change!   
   > I did wonder if it was a quirk of using a Function and tried calling a   
   > Subroutine from the Function with the Workbooks.Open command in the   
   > subroutine but that fails too.   
   >   
   > Peter   
   >   
   >   
   > "Elef"  wrote in message   
   > news:E8E1e.23974$kC3.6054@tornado.fastwebnet.it...   
   >> Are you aware of the following constraint when building functions to be   
   >> called from a worksheet formula (User Defined Functions) ?:   
   >>   
   >> A function used in a formula can return a value. It cannot make any   
   >> changes to the workbook.   
   >>   
   >> Hope it helps.   
   >> Bye   
   >> Elef   
   >>   
   >> "Peter"  ha scritto nel messaggio   
   >> news:chy1e.14216$XH5.11163@fe1.news.blueyonder.co.uk...   
   >>> If I have workbook "one.xls" open and try to open a second workbook from   
   >>> within a subroutine using   
   >>>   
   >>> Workbooks.Open "E:\Data\Excel\Two.xls"   
   >>>   
   >>> "Two.xls" opens as expected.   
   >>>   
   >>> but if I place the same line of code in a Function rather than a   
   >>> subroutine "Two.xls" does not open!   
   >>>   
   >>> Any ideas?  All I'm trying to do is to extract some data from one sheet   
   >>> & copy it to another.   
   >>>   
   >>>   
   >>> --   
   >>> Peter   
   >>> To err is human but it takes a computer to really mess things up!   
   >>>   
   >>   
   >>   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca