ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   workbook as variable (https://www.excelbanter.com/excel-programming/289101-workbook-variable.html)

pete

workbook as variable
 
for a newly created workbook, how can I store a reference to the
workbook in a variable ,

thanks

pete


Chip Pearson

workbook as variable
 
Pete,

Try something like

Dim WB As Workbook
Set WB = ActiveWorkbook
' or
Set WB = Workbooks.Add()


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"pete" wrote in message
...
for a newly created workbook, how can I store a reference to

the
workbook in a variable ,

thanks

pete




Rob van Gelder[_4_]

workbook as variable
 
Pete,

Sub test()
Dim wkb As Workbook

Set wkb = Workbooks.Add
MsgBox wkb.FullName
End Sub

Rob


"pete" wrote in message
...
for a newly created workbook, how can I store a reference to the
workbook in a variable ,

thanks

pete





All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com