Replacing formulas with values from DLL

T

T G

I have a DLL that uses Microsoft Excel C API to modify data in Excel
documents. It's an old DLL developed 6-7 years ago that needs to get a few
fixes. It compiles in Visual C++ 6.

I have Excel documents where the cells have formulas getting values that the
user can see. I need to build a function in my DLL that replaces all formulas
with the actual values.

Can anyone give me a hint on what functions to use?

I would also appreciate if someone has links to documentation on how
functions like Excel, Excel4, xlcWorkbookSelect, xlCoerce, xlFree,
xlfEvaluate, etc works as it seems like all help on MSDN have disappeared.

Thanks in advance /T
 
T

T G

Probably, if I knew how to do it ;)

Could you give me a short sample code on what functions to use?

As I said in my first post the documentation on Microsoft Excel C API
doesn't seem to exist anymore on MSDN.

/T
 
N

NickHK

Recording a macro in Excel of your required actions will give you the VBA
code.
Then it's up to you to translate that to C++.

But something like :

Range("A1").Copy
Range("E11").PasteSpecial Paste:=xlPasteValues

NickHK
 
P

Peter Huang [MSFT]

Hi,

Since XLL in C API is an old technology.
Currently we have many new extensions for Office production.
e.g. Excel Automation with any COM ready language(C++/VB/.NET), VSTO
216686 How To Automate Excel From C++ Without Using MFC or #import
http://support.microsoft.com/default.aspx?scid=kb;EN-US;216686

196135 How To Create an Automation Client Project Using ATL
http://support.microsoft.com/default.aspx?scid=kb;EN-US;196135

238972 INFO: Using Visual C++ to Automate Office
http://support.microsoft.com/default.aspx?scid=kb;EN-US;238972

If you have any other concern, please let me know.




Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi,

This is an update for this issue.

There's no easy way to access the IDispatch OM (i.e. what you'd use if you
were programming in VB/VBA) from an XLL. XLLs use the XLM programming
language to talk to XL. The best reference for the XLM programming
language is macrofun.hlp, available here:
http://support.microsoft.com/kb/128185. Add either "xlf" or "xlc" to the
command you wish to call from Excel4()/Excel12(). They should all be
defined in xlcall.h.

The archived XLL documentation is available at:
http://msdn.microsoft.com/archive/.
Expand the following: Office Solutions Development / Microsoft Office 97 /
Office 97 / Product Documentation / Excel / Microsoft Excel 97 Developer¡¯s
Kit.
Click ¡°Introduction¡± - that should get you to the first "page" of the
book.

For your scenario, did my previous suggestion help you, e.g. write a C++
COM Addin to manipulate the Excel Object Modal and which will do almost all
the job you do with Excel Menu/toolbar.
This is the Excel Object Modal reference which is installed with Office
problem.(below is for Office 11, excel 2003)
<Program Files>\Microsoft Office\OFFICE11\1033\VBAXL10.CHM

If you still have any other concern, please let me know.


Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top