[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

RE: >> Repeating code

alok

12/18/2006 9:13:00 PM

Jonathan,

What triggers the execution of the following line?

Call AddProduct("myNewSheet Test", False)

Alok

"Jonathan" wrote:

> Hi, I'm calling the following function....
>
> Public Function AddProduct(ByVal newSheetName As String, Optional
> calledByUser As Boolean = True) As Boolean
>
> with the following line...
>
> Call AddProduct("myNewSheet Test", False)
>
> when executing the first lines...
>
> With ActiveWorkbook
> 'Append new worksheet with default layout
> .Worksheets("Layout").Copy After:=.Worksheets(.Worksheets.Count)
> 'Reference new worksheet
> Set wksNew = .Worksheets(.Worksheets.Count)
> End With
> 'Assign name to new worksheet
> wksNew.Name = newSheetName
>
> the line...
>
> .Sheets("Layout").Copy After:=.Worksheets(.Worksheets.Count)
>
> seems to become a call-back. That is execution jumps back to the function
> name and loops through the code.
>
> This function is located in a standard module and the test call is from the
> same module. There is no OnOpen/Autoexec in this workbook.