Workbook name as variable to another workbook

Hi,

Can you save a specific workbook name as a variable, to be used in a 
different macro? i need the variable to be saved and available to return to 
the specific workbook open if i have a lot of books open to complete the task.

Regards,

nigel

0
Nigel (119)
5/17/2005 9:43:30 AM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
324 Views

Similar Articles

[PageSpeed] 0

Option Explicit
Dim myWkbkName As String
Sub runmefirst()
    myWkbkName = ThisWorkbook.Name
End Sub
Sub runmesecond()
    MsgBox myWkbkName
End Sub

If you execute runmefirst first, then runmesecond, you'll see that myWkbkname is
available in the second.

If you need to put the routines in different modules, declare myWkbkName as
Public:
Public myWkbkName As String




Nigel wrote:
> 
> Hi,
> 
> Can you save a specific workbook name as a variable, to be used in a
> different macro? i need the variable to be saved and available to return to
> the specific workbook open if i have a lot of books open to complete the task.
> 
> Regards,
> 
> nigel

-- 

Dave Peterson
0
ec357201 (5290)
5/17/2005 1:26:53 PM
Reply:

Similar Artilces: