喜大普奔之终于会用C写Excel Function了
2015-09-21 15:41
369 查看
今天有狗屎运,居然看到了:https://sites.google.com/site/jrlhost/links/excelcdll
简直是我的救星。基本顺着看下来就能搞定。然后吐槽一句,公司居然是x32的office, I 服了U。目前没有想明白为什么。
代码里面要注意的地方:
棒棒哒~
简直是我的救星。基本顺着看下来就能搞定。然后吐槽一句,公司居然是x32的office, I 服了U。目前没有想明白为什么。
代码里面要注意的地方:
Option Explicit ' This file provides an example of calling a C function in a DLL ' It was writen on a computer with Windows 7 64-bit and Excel 2010 64-bit and has been tested on a computer with Windows 7 32-bit and Excel 2010 32-bit ' It is provided as an example only. I make no waranties or guarantees about this file, the associated DLL file, the methods contained within, the steps described here or on my website, or anything else. I am unaware of any problems that could be caused by any of these materials, but as with any other code or computer files you find online, use at your own risk. ' The entire example is based on the example shown http://www.youtube.com/watch?v=x3WWA8eEX9Q, with the addition of the squareOnWorksheet() function and Private keyword in the Declare statement ' Author: Jonathan Lhost (jrlhost@utexas.edu) June 17, 2012 ' Declare the function that's in the DLL Private Declare PtrSafe Function squareForEXL Lib _ '以下这个路径差点让我放弃,一开始就没想过公司office是x32。干得好,又让我虚度光阴片刻钟... "C:\Users\msong1\Documents\Visual Studio 2010\Projects\SquareDLL\Debug\SquareDLL.dll" (ByRef x As Double) As Double ' Use function on worksheet Function squareOnWorksheet(dArg As Double) As Double squareOnWorksheet = squareForEXL(dArg) End Function ' Example using the function from VBA Sub useSquareInVBA() MsgBox squareForEXL(10) End Sub
棒棒哒~
相关文章推荐
- gets函数哈scanf函数的区别
- LoghtOj1201(最大独立集)
- iOS—NSLog各种打印格式
- 由is_base_of看C++中的SFINAE
- 关于PHP浮点数你应该知道的(All ‘bogus’ about the float in PHP)
- Discuz论坛搭建
- MS SQL 全局临时表的删除
- zabbix 设备(自己的实践)
- 洗牌算法
- html 锚点
- Android 官方推荐 : DialogFragment 创建对话框
- Openssl的安装
- IAR将变量定义在指定地址
- 解决xManager、putty等工具ssh连接linux中文乱码
- android布局相关
- 【bzoj3524】【poi2014】【couriers】【可持久化线段树】
- iOS--进阶知识--Runtime
- 数组引用vs引用数组
- SQLSERVER 中架构的概念
- 关于fragment+viewpager的优化