Thanks Peter.
the is in place works fine.
but the container errors as in Excel but I'll do it with is in place only.
Other question.
Do you know how I could launch a Sub every time a new workbook is open.
I have included this scipt in the auto open section of an add-in.
I can identify the cases when i need to launch my sub that changes the color
index / color theme (necessary only when I display an excel graph embedded in
Powerpoint)
If I include directly my sub in the auto open (which includes
activeworkbook.colors...), it does not work, because when the add in is
loaded, there is not yet any active book....
IS there a way to put in a single addin a sub that will be lauched every
time a new workbook is opened or created ??
> If you only need to know if the Workbook is embedded is to check its
> IsInPlace property, False if opened in Excel otherwise True. If you need to
[quoted text clipped - 9 lines]
> On error got to 0
> If len(s) then etc
Peter T - 11 Apr 2008 18:36 GMT
As I mentioned previously it's best to postpone open event code until
everything is in-place! You can do this with an onetime macro like this -
Sub auto_open()
Application.OnTime Now + TimeSerial(0, 0, 2), "MyAfterOpenMacro"
End Sub
Sub MyAfterOpenMacro()
Dim wb As Workbook
MsgBox "MyAfterOpenMacro"
Set wb = ThisWorkbook
If wb.IsInplace Then
' do stuff
End If
End Sub
You might not need the two second delay in the above example as the Ontime
macro will fire when all else is done, in a manor of speaking.
Regards,
Peter T
> Thanks Peter.
>
[quoted text clipped - 32 lines]
>> On error got to 0
>> If len(s) then etc