matlab提供notebook工具箱,可以让我们在word运行matlab代码,这是一个非常方便的功能,但是如果你的office和matlab是安装在64位的机子上的话,可能会报以下错误:
这时候实在令人抓狂,因为我一开始还以为是由于我的word与matlab版本不对应,所以运行不了notebook,但是经过google后,可以通过修改以下代码就可以修复:
添加PtrSafe属性,将:
Private Declare Function WinHelp Lib "USER32.DLL" Alias "WinHelpA" (ByVal hWnd As Integer, ByVal lpHelpFile _
As String, ByVal wCmd As Integer, ByVal dwData As String) As Integer
Private Declare Function GetActiveWindow Lib "USER32.DLL" () As Integer
改为:
Private Declare PtrSafe Function WinHelp Lib "USER32.DLL" Alias "WinHelpA" (ByVal hWnd As Integer, ByVal lpHelpFile _
As String, ByVal wCmd As Integer, ByVal dwData As String) As Integer
Private Declare PtrSafe Function GetActiveWindow Lib "USER32.DLL" () As Integer
感谢百度知道的大神。