excel [tab] property for worksheet is missing?

Add-in Express™ Support Service
That's what is more important than anything else

excel [tab] property for worksheet is missing?
renewed 
Michał Głębowski




Posts: 42
Joined: 2015-06-08
I found a thread for .NET version here:
www.add-in-express.com/forum/read.php?a&FID=5&TID=2758&MID=12868&SHOWALL_1=0
But it was not solved. Is there any progress in adding .Tab property to Worksheet?
Michal
Posted 26 Feb, 2016 05:20:37 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Michał,

Recording a VBA macro while changing a sheet's tab color reveals the objects and properties involved:

Sub Macro1()
'
' Macro1 Macro
'

'
    Sheets("Sheet1").Select
    With ActiveWorkbook.Sheets("Sheet1").Tab
        .Color = 255
        .TintAndShade = 0
    End With
End Sub


The Worksheet.Tab property was introduced in Excel 2002. To access it in your add-in (it is built using Office 2000 type libraries) you need to use late binding.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 26 Feb, 2016 06:17:48 Top
Michał Głębowski




Posts: 42
Joined: 2015-06-08
Dear Andrei,
OK, your answer suits me fine. I found already proper topic:
https://www.add-in-express.com/creating-addins-blog/2010/03/16/interop-assemblies-late-binding/
Michal
Posted 10 Mar, 2016 05:39:01 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Michał,

Michał Głębowski writes:
does not work due to lack of Tab property.


That property doesn't exist in the type library of Excel 2000 (the property was introduced in Excel 2002). Your add-in uses this type library; this is always the case with Add-in Express based add-ins. To bypass this, you can invoke that property via late binding. Alternatively, you can import the type library of the Excel version that you use, perform required cast operations and use the property; see e.g. https://www.add-in-express.com/forum/read.php?FID=1&TID=12731.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Mar, 2016 05:46:24 Top
Michał Głębowski




Posts: 42
Joined: 2015-06-08
Dear Andrei,
I already changed my original post, but coming back to your previous answer, I'd like to use late binding method. However the link to late binding sample reveals Outlook and .Net/VBA platform with no code sample. Is it possible to get simple code sample for Delphi (where to find InvokeMethod function)?
Michal
Posted 10 Mar, 2016 05:56:23 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Michał,

Please check https://www.add-in-express.com/forum/read.php?FID=1&TID=12494.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Mar, 2016 06:14:33 Top