View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Medemper Medemper is offline
external usenet poster
 
Posts: 26
Default Passing variable from one sub to another

Can you just put a call into your other sub in the Workbook_BeforeClose sub?

Sub Workbook_BeforeClose() 'I don't remember what's in the () just leave as is
Call SaveAsSub
End sub

To pass variables, it would have to be part of the declaration of the routine, and part of the call from the other routine.

Sub PassAVariable()
Dim t as integer
t=4
Call PassedTheVariable(t)
End Sub

Sub PassedTheVariable(x as integer) 'doesn't have to be same name just same type
y = x 'making y = 4
End sub
"Matt" wrote in message ...
I have a sub that displays a SaveAs dialog box that already has the default file location, name, and type in it. However, I would like to put the same code in the Workbook_BeforeClose sub so that they get the same dialog box as the other sub. I can't figure out how to get the Workbook sub to receive the filename(or any other variable for that matter) from the other sub. Or if you have any better ideas, that would be great. Thanks. Matt.