![]() |
Create own properties?
Is it possible to create ones own property to an Excel object?
Example: The workbook has some builtin properties, like... ThisWorkbook.Path ThisWorkbook.Name etc... I would like to create a... ThisWorkbook.URL ....which, obvious, would return the URL from where on the Intranet (or Internet :-) the user can always find the newest version of the workbook, and also use this new property, in my own macros, for further programming, like data links in the workbooks URL path. I'm aware that it would probably require some sort of programming in the Workbook_Open event, but that doesn't matter - just as long as I have the property for the rest of the time that the workbook is open. Possible? TIA, |
Create own properties?
Yes. Eg: enter this in the "ThisWorkbook" module in the VBE:
Property Get URL() As String URL = "http://www.google.com" End Property Tim "Charlotte E" <@ wrote in message ... Is it possible to create ones own property to an Excel object? Example: The workbook has some builtin properties, like... ThisWorkbook.Path ThisWorkbook.Name etc... I would like to create a... ThisWorkbook.URL ...which, obvious, would return the URL from where on the Intranet (or Internet :-) the user can always find the newest version of the workbook, and also use this new property, in my own macros, for further programming, like data links in the workbooks URL path. I'm aware that it would probably require some sort of programming in the Workbook_Open event, but that doesn't matter - just as long as I have the property for the rest of the time that the workbook is open. Possible? TIA, |
Create own properties?
Awesome :-)
Thanks, Tim :-) Tim Williams wrote: Yes. Eg: enter this in the "ThisWorkbook" module in the VBE: Property Get URL() As String URL = "http://www.google.com" End Property Tim "Charlotte E" <@ wrote in message ... Is it possible to create ones own property to an Excel object? Example: The workbook has some builtin properties, like... ThisWorkbook.Path ThisWorkbook.Name etc... I would like to create a... ThisWorkbook.URL ...which, obvious, would return the URL from where on the Intranet (or Internet :-) the user can always find the newest version of the workbook, and also use this new property, in my own macros, for further programming, like data links in the workbooks URL path. I'm aware that it would probably require some sort of programming in the Workbook_Open event, but that doesn't matter - just as long as I have the property for the rest of the time that the workbook is open. Possible? TIA, |
Create own properties?
Yes. Eg: enter this in the "ThisWorkbook" module in the VBE:
Property Get URL() As String URL = "http://www.google.com" End Property Is it possible to do the opposite? I.e.: ThisWorkbook.URL = http://www.google.com/ ....so it can be read later with: MsgBox ThisWorkbook.URL ??? |
Create own properties?
Dim m_URL as string
Property Let URL(val as String) m_URL = val End Property Property Get URL() as String URL = m_URL End Property Tim "Charlotte E" <@ wrote in message ... Yes. Eg: enter this in the "ThisWorkbook" module in the VBE: Property Get URL() As String URL = "http://www.google.com" End Property Is it possible to do the opposite? I.e.: ThisWorkbook.URL = http://www.google.com/ ...so it can be read later with: MsgBox ThisWorkbook.URL ??? |
Create own properties?
One letter wrong!!!!
I tried with: Property Set Thanks, Tim :-) Tim Williams wrote: Dim m_URL as string Property Let URL(val as String) m_URL = val End Property Property Get URL() as String URL = m_URL End Property Tim "Charlotte E" <@ wrote in message ... Yes. Eg: enter this in the "ThisWorkbook" module in the VBE: Property Get URL() As String URL = "http://www.google.com" End Property Is it possible to do the opposite? I.e.: ThisWorkbook.URL = http://www.google.com/ ...so it can be read later with: MsgBox ThisWorkbook.URL ??? |
Create own properties?
yup. SET is for assigning OBJECTS. easy mistake to make too
"Charlotte E" <@ wrote in message ... One letter wrong!!!! I tried with: Property Set Thanks, Tim :-) Tim Williams wrote: Dim m_URL as string Property Let URL(val as String) m_URL = val End Property Property Get URL() as String URL = m_URL End Property Tim "Charlotte E" <@ wrote in message ... Yes. Eg: enter this in the "ThisWorkbook" module in the VBE: Property Get URL() As String URL = "http://www.google.com" End Property Is it possible to do the opposite? I.e.: ThisWorkbook.URL = http://www.google.com/ ...so it can be read later with: MsgBox ThisWorkbook.URL ??? |
All times are GMT +1. The time now is 02:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com