Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA basics
Hello,
I wonder why the following Excel VBA code does not work. Sub test() Dim myBook As Workbook myBook = ActiveWorkbook Debug.Print "the book name is" & myBook.Name End Sub Is it not possible to assign the reference to the workbook to a variable? Thanks for answers Phil |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA basics
Hi,
Try ....... Set myBook = ActiveWorkbook ........ Kind Regards. -- Haldun Alay "Philipp" , haber iletisinde sunlari ... Hello, I wonder why the following Excel VBA code does not work. Sub test() Dim myBook As Workbook myBook = ActiveWorkbook Debug.Print "the book name is" & myBook.Name End Sub Is it not possible to assign the reference to the workbook to a variable? Thanks for answers Phil |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA basics
Hi,
You need to use the Set command as it is an object variable. Set myBook = ActiveWorkbook Cheers Andy Philipp wrote: Hello, I wonder why the following Excel VBA code does not work. Sub test() Dim myBook As Workbook myBook = ActiveWorkbook Debug.Print "the book name is" & myBook.Name End Sub Is it not possible to assign the reference to the workbook to a variable? Thanks for answers Phil -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA basics
Haldun Alay wrote:
Hi, Try ...... Set myBook = ActiveWorkbook ....... OK that worked. Thank you for your prompt answers. Phil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Back to basics of excel 2003 | Excel Worksheet Functions | |||
Excel Forms: The basics please | Excel Discussion (Misc queries) | |||
Hi I'm New and need help with Excel Basics | Excel Discussion (Misc queries) | |||
Excel Basics | Excel Discussion (Misc queries) | |||
Transfering Acces Tabel to Excel with Visual Basics | Excel Programming |