Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring a constant to the Workbook Name?
I am trying to declare a constant which will hold the workbook name (Th
workbook running the macro that is). So I am doing Public Const WorkBookName As String = ThisWorkbook.name First thing in Module 1 but I keep getting: "Constant Expression Required" How can I declare the constant with the workbooks name? Best Regards Noo -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring a constant to the Workbook Name?
The workbook name is not a constant value so needs to be assigned usin
Dim as a variable. Duncan 'excel.duncan-fiona.co.uk' (http://www.excel.duncan-fiona.co.uk) (When I get it finished that is... -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring a constant to the Workbook Name?
You already have a constant you can access
Thisworkbook.Name Why reinvent the wheel? If you want to store the name because you are going to change it, then just use a variable (rather than a constant). -- Regards, Tom Ogilvy "NooK " wrote in message ... I am trying to declare a constant which will hold the workbook name (The workbook running the macro that is). So I am doing Public Const WorkBookName As String = ThisWorkbook.name First thing in Module 1 but I keep getting: "Constant Expression Required" How can I declare the constant with the workbooks name? Best Regards NooK --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring a constant to the Workbook Name?
I am not gonna change just tought it'd look nicer to have a variabl
instead of writing Thisworkbook.name all the time. Anyway, thanks for the answer. I think this might be the best solution in this case. Best Regards Noo -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reference constant cells in different files from a master workbook | Excel Worksheet Functions | |||
Declaring variables | Excel Discussion (Misc queries) | |||
Declaring a DLL | Excel Programming | |||
Declaring a variable? | Excel Programming | |||
Declaring Variables | Excel Programming |