View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default Use Macro from Source

Normally, I would create a new toolbar (Tools|Customize command), add the
button to it, then attach the toolbar to Workbook A. Hide Workbook A, then
go into the VBA editor and save again (make sure to select Workbook A in
the Project Explorer window first). Now, when Workbook B is active, the
button will automatically perform its actions on Workbook B, assuming that
you set a reference to the active workbook as the first line of code.

Public Sub TryThis()
Dim wbData as Workbook

Set wbData = ActiveWorkbook

'Do your processing here.
End Sub

--
Regards,
Bill Renaud