Application.Calculation, Read/Write, requires a visible workbook in place,
ie an active workbook. Defer your routine by calling with the Ontime method.
'Now' is OK, it won't run until everything related to Startup is done, in
particular an active workbook is present.
Regards,
Peter T
"Pflugs" <(E-Mail Removed)> wrote in message
news:EA8F7051-2349-487B-914F-(E-Mail Removed)...
> I'm getting a mismatch error when I install my custom add-in, but it
doesn't
> make sense. Below is my code:
>
> Set myButton = myBar.Controls.Add(Type:=msoControlButton)
> With myButton
> If Application.Calculation = xlCalculationManual Then
> .FaceId = 349
> .TooltipText = "Click here to set calculation method to
> AUTOMATIC."
> Else
> .FaceId = 346
> .TooltipText = "Click here to set calculation method to
MANUAL."
> End If
> end with
>
> When Excel is first started, the error occurs at the
> "Application.Calculation" line. However, when I enter the debugger and
step
> through, the code continues without error. If this add-in is installed
after
> the application has fully started, then there seems to be no problem.
>
> I see that when no workbook is open, the Options settings are unavailable.
> Is there any way to check if the application has fully started?
>
> Thanks,
> Pflugs
|