store active workbook

G

greg

OK,
This must be something simple. That I just don't see.
If I want to store the active workbook in a property.
I am trying the following code. However I am getting an error on setting
the activeworkbook.

Anyone have any ideas?
thanks



Private m_objWorkspaceWorkbook As New Excel.Workbook

Public Property Set WorkspaceWorkbook(ByVal vData As Excel.Workbook)
Set m_objWorkspaceWorkbook = vData
End Property

Public Property Get WorkspaceWorkbook() As Excel.Workbook
Set WorkspaceWorkbook = m_objWorkspaceWorkbook
End Property


Sub xxx()
Dim objWB As Excel.Workbook
Set objWB = Excel.ActiveWorkbook
WorkspaceWorkbook objWB '??????????
End Sub
 
J

JNW

I generally store the name then use that to recall the workbook later.

aWB = activeworkbook.name

workspaceworkbook = workbooks(aWB)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top