Reputation: 1902
I have a C++ ATL COM adding that implements some utility functions that refer to the Excel API:
void DoSomething(CComPtr<Excel::Range> &masterCell)
{
// ...
CComPtr<Excel::Range> cell = masterCell->Offset[vertical][horizontal];
// ...
}
When compiling an excel addin for x64 I'm getting lots of spurious errors such as:
cannot convert from 'Excel::Range' to 'ATL::CComPtr<T>'
However, when I compile for Win32 there is no problem. The helper utility functions are not exposed as excel UDF's so I don't think this question is applicable since the function does not have a STDMETHODIMP
part.
Any ideas?
Thanks in advance.
Upvotes: 0
Views: 220
Reputation: 1902
Doh! Turns out that I was trying to reference a 32-bit excel installation in a 64-bit build:
Installing 64-bit excel fixed the issue.
Upvotes: 0
Reputation: 69687
CComPtr
accepts an interface as a template argument, while Range
is dispinterface. You need CComPtr<Excel::IRange>
instead.
Upvotes: 2