Excel中VBA code:在x64版本的编译错误(需要'PTRSAFE'属性) [英] Excel VBA Code: Compile Error in x64 Version ('PtrSafe' attribute required)

查看:3375
本文介绍了Excel中VBA code:在x64版本的编译错误(需要'PTRSAFE'属性)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Win8的64 +办公室2013 64。

我的问题:

我有一个Excel文件,该文件中有一些模块,和完美的作品在Office(Excel中)86。它使用瑞士星历文件( swedll32.dll )做了很多天文计算的。

然而,当我尝试我的结束,这是对Excel的64位运行,尽快它的开业,VBA编辑器火起来,给了我以下错误:

 编译错误:
在code在该项目必须更新,在64位系统中使用。
请查看并更新Declare语句,然后与PTRSAFE属性将它们标记。
 

正如我上面所说的,它只能在32位的Office(Excel)中,但它不会在我的x64工作的Excel不过似乎有一种解决方法,但我太新手得到它。

我在VBA没有好,但是,挖在互联网上后,一些网站建议,对于64位的Office(Excel)中,我们应该修订(每个申报)在codeS到这样的事情:

  • 声明原文:私人声明函数
  • 修订声明:私人声明的 PTRSAFE 功能

不幸的是,添加后 PTRSAFE 随处可见,在细胞虽然VBA错误停止,但显示没有值/计算正确。

这是64位的VBA微软后,它似乎我们还需要修改一些数据类型,例如:

  • 龙→到→LongPtr
  • LongPtr→到→龙龙
  • 有些长都应该保持不变,这取决于他们做什么。

本网站(下其中多头应该成为LongPtr?)看出端倪,虽然,作为如何知道修改哪一个。

我不明白一个关于它的事情,不知道应该怎样做真正使这项工作在Office(Excel中)64。有人谁是pretty的擅长这个,请,请帮助我。请。

注意:

  • 只有出现在红色,表示它们包含错误已被倾倒在这里的声明。的codeS的剩余部分没有被粘贴在这里,因为它们出现细(绿色彩色)。如果你想看看文件,该文件可以在这里下载: http://bit.ly/Z8Kqm9
  • Excel文件到您的计算机上正常工作,确保双方的swedll32.dll'和;在JCalc版本0.2d.xls'都在同一个文件夹中,其提取后。

在模块名称问题: MainCalculations

 瑞士历发行1.60 9-JAN-2000

声明的Vis​​ual Basic 5.0
该DLL文件必须存在于同一目录下,或者在系统
目录下就可以在运行时发现


    私人声明函数swe_azalt库swedll32.dll_
    别名_swe_azalt @ 40(_
      BYVAL tjd_ut作为双,_
      BYVAL calc_flag长,_
      为ByRef geopos作为双,_
      BYVAL为preSS作为双,_
      BYVAL学尝试为DOUBLE,_
      为ByRef昕双,_
      为ByRef XAZ作为双_
    )作为龙'geopos必须是第3数组元素的
               鑫必须是第2个数组元素
               'XAZ必须是第3数组元素的

    私人声明函数swe_azalt_rev库swedll32.dll_
    别名_swe_azalt_rev @ 24(_
      BYVAL tjd_ut作为双,_
      BYVAL calc_flag长,_
      为ByRef geopos作为双,_
      为ByRef昕双,_
      为ByRef XOUT作为双_
    )作为龙'geopos必须是第3数组元素的
               鑫必须是第2个数组元素
               'XOUT必须是第3数组元素的

私人声明函数swe_calc库swedll32.dll_
    别名_swe_calc @ 24(_
      BYVAL TJD为DOUBLE,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                SERR必须能容纳256字节

私人声明函数swe_calc_d库swedll32.dll_
    别名_swe_calc_d @ 20(_
      为ByRef TJD为DOUBLE,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                    SERR必须能容纳256字节

私人声明函数swe_calc_ut库swedll32.dll_
    别名_swe_calc_ut @ 24(_
      BYVAL tjd_ut作为双,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                SERR必须能容纳256字节

私人声明函数swe_calc_ut_d库swedll32.dll_
    别名_swe_calc_ut_d @ 20(_
      为ByRef tjd_ut作为双,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                    SERR必须能容纳256字节

私人声明函数swe_close库swedll32.dll_
    别名_swe_close @ 0(_
    ) 只要

私人声明函数swe_close_d库swedll32.dll_
    别名_swe_close_d @ 4(_
      BYVAL ivoid只要_
    )只要'的说法ivoid被忽略

私人声明子swe_cotrans库swedll32.dll_
    别名_swe_cotrans @ 16(_
      为ByRef XPO作为双,_
      为ByRef XPN为DOUBLE,_
      BYVAL每股收益双_
    )

私人声明函数swe_cotrans_d库swedll32.dll_
    别名_swe_cotrans_d @ 12(_
      为ByRef XPO作为双,_
      为ByRef XPN为DOUBLE,_
      ByRef的每股收益双_
    ) 只要

私人声明子swe_cotrans_sp库swedll32.dll_
    别名_swe_cotrans_sp @ 16(_
      为ByRef XPO作为双,_
      为ByRef XPN为DOUBLE,_
      BYVAL每股收益双_
    )

私人声明函数swe_cotrans_sp_d库swedll32.dll_
    别名_swe_cotrans_sp_d @ 12(_
      为ByRef XPO作为双,_
      为ByRef XPN为DOUBLE,_
      ByRef的每股收益双_
    ) 只要

私人声明子swe_cs2degstr库swedll32.dll_
    别名_swe_cs2degstr @ 8(_
      BYVAL T作为龙_
      BYVAL参考译文]字符串_
    )

私人声明函数swe_cs2degstr_d库swedll32.dll_
    别名_swe_cs2degstr_d @ 8(_
      BYVAL T作为龙_
      BYVAL参考译文]字符串_
    ) 只要

私人声明子swe_cs2lonlatstr库swedll32.dll_
    别名_swe_cs2lonlatstr @ 16(_
      BYVAL T作为龙_
      BYVAL PChar类型为字节,_
      BYVAL mchar为字节,_
      BYVAL参考译文]字符串_
    )

私人声明函数swe_cs2lonlatstr_d库swedll32.dll_
    别名_swe_cs2lonlatstr_d @ 16(_
      BYVAL T作为龙_
      为ByRef PChar类型为字节,_
      为ByRef mchar为字节,_
      BYVAL参考译文]字符串_
    ) 只要

私人声明子swe_cs2timestr库swedll32.dll_
    别名_swe_cs2timestr @ 16(_
      BYVAL T作为龙_
      BYVAL月长,_
      BYVAL supzero长,_
      BYVAL参考译文]字符串_
    )

私人声明函数swe_cs2timestr_d库swedll32.dll_
    别名_swe_cs2timestr_d @ 16(_
      BYVAL T作为龙_
      BYVAL月长,_
      BYVAL supzero长,_
      BYVAL参考译文]字符串_
    ) 只要

私人声明函数swe_csnorm库swedll32.dll_
    别名_swe_csnorm @ 4(_
      BYVAL数p作为龙_
    ) 只要

私人声明函数swe_csnorm_d库swedll32.dll_
    别名_swe_csnorm_d @ 4(_
      BYVAL数p作为龙_
    ) 只要

私人声明函数swe_csroundsec库swedll32.dll_
    别名_swe_csroundsec @ 4(_
      BYVAL数p作为龙_
    ) 只要

私人声明函数swe_csroundsec_d库swedll32.dll_
    别名_swe_csroundsec_d @ 4(_
      BYVAL数p作为龙_
    ) 只要

私人声明函数swe_d2l库swedll32.dll_
    别名_swe_d2l @ 8(_
    ) 只要

私人声明函数swe_d2l_d库swedll32.dll_
    别名_swe_d2l_d @ 4(_
    ) 只要

私人声明函数swe_date_conversion库swedll32.dll_
    别名_swe_date_conversion @ 28(_
      BYVAL一年,龙,_
      BYVAL月长,_
      BYVAL每天只要,_
      BYVAL UTIME作为双,_
      BYVAL CAL为字节,_
      为ByRef TJD作为双_
    ) 只要

私人声明函数swe_date_conversion_d库swedll32.dll_
    别名_swe_date_conversion_d @ 24(_
      BYVAL一年,龙,_
      BYVAL月长,_
      BYVAL每天只要,_
      为ByRef UTIME作为双,_
      为ByRef CAL为字节,_
      为ByRef TJD作为双_
    ) 只要

私人声明函数swe_day_of_week库swedll32.dll_
    别名_swe_day_of_week @ 8(_
      BYVAL JD作为双_
    ) 只要

私人声明函数swe_day_of_week_d库swedll32.dll_
    别名_swe_day_of_week_d @ 4(_
      为ByRef JD作为双_
    ) 只要

私人声明函数swe_degnorm库swedll32.dll_
    别名_swe_degnorm @ 8(_
      BYVAL JD作为双_
    )作为双

私人声明函数swe_degnorm_d库swedll32.dll_
    别名_swe_degnorm_d @ 4(_
      为ByRef JD作为双_
    ) 只要

私人声明函数swe_deltat库swedll32.dll_
    别名_swe_deltat @ 8(_
      BYVAL JD作为双_
    )作为双

私人声明函数swe_deltat_d库swedll32.dll_
    别名_swe_deltat_d @ 8(_
      为ByRef JD作为双,_
      为ByRef的DeltaT作为双_
    ) 只要

私人声明函数swe_difcs2n库swedll32.dll_
    别名_swe_difcs2n @ 8(_
      BYVAL P1长,_
      BYVAL P2只要_
    ) 只要

私人声明函数swe_difcs2n_d库swedll32.dll_
    别名_swe_difcs2n_d @ 8(_
      BYVAL P1长,_
      BYVAL P2只要_
    ) 只要

私人声明函数swe_difcsn库swedll32.dll_
    别名_swe_difcsn @ 8(_
      BYVAL P1长,_
      BYVAL P2只要_
    ) 只要

私人声明函数swe_difcsn_d库swedll32.dll_
    别名_swe_difcsn_d @ 8(_
      BYVAL P1长,_
      BYVAL P2只要_
    ) 只要

私人声明函数swe_difdeg2n库swedll32.dll_
    别名_swe_difdeg2n @ 16(_
      BYVAL P1作为双,_
      BYVAL P2作为双_
    )作为双

私人声明函数swe_difdeg2n_d库swedll32.dll_
    别名_swe_difdeg2n_d @ 12(_
      为ByRef P1作为双,_
      为ByRef P2作为双,_
      为ByRef的Diff作为双_
    ) 只要

私人声明函数swe_difdegn库swedll32.dll_
    别名_swe_difdegn @ 16(_
      BYVAL P1作为双,_
      BYVAL P2作为双_
    ) 只要

私人声明函数swe_difdegn_d库swedll32.dll_
    别名_swe_difdegn_d @ 12(_
      为ByRef P1作为双,_
      为ByRef P2作为双,_
      为ByRef的Diff作为双_
    ) 只要

私人声明函数swe_fixstar库swedll32.dll_
    别名_swe_fixstar @ 24(_
      BYVAL明星作为字符串_
      BYVAL TJD为DOUBLE,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                    SERR必须能容纳256字节
                    明星必须能容纳40个字节

私人声明函数swe_fixstar_d库swedll32.dll_
    别名_swe_fixstar_d @ 20(_
      BYVAL明星作为字符串_
      为ByRef TJD为DOUBLE,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                    SERR必须能容纳256字节
                    明星必须能容纳40个字节

私人声明函数swe_fixstar_ut库swedll32.dll_
    别名_swe_fixstar_ut @ 24(_
      BYVAL明星作为字符串_
      BYVAL tjd_ut作为双,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                    SERR必须能容纳256字节
                    明星必须能容纳40个字节

私人声明函数swe_fixstar_ut_d库swedll32.dll_
    别名_swe_fixstar_ut_d @ 20(_
      BYVAL明星作为字符串_
      为ByRef tjd_ut作为双,_
      BYVAL IFLAG长,_
      为ByRef×如双,_
      BYVAL SERR作为字符串_
    )只要'x必须是前六的数组元素
                    SERR必须能容纳256字节
                    明星必须能容纳40个字节

私人声明函数swe_get_ayanamsa库swedll32.dll_
    别名_swe_get_ayanamsa @ 8(_
      BYVAL tjd_et作为双_
    )作为双

私人声明函数swe_get_ayanamsa_d库swedll32.dll_
    别名_swe_get_ayanamsa_d @ 8(_
      为ByRef tjd_et作为双,_
      为ByRef阿燕由于双_
    ) 只要

私人声明函数swe_get_ayanamsa_ut库swedll32.dll_
    别名_swe_get_ayanamsa_ut @ 8(_
      BYVAL tjd_ut作为双_
    )作为双

私人声明函数swe_get_ayanamsa_ut_d库swedll32.dll_
    别名_swe_get_ayanamsa_ut_d @ 8(_
      为ByRef tjd_ut作为双,_
      为ByRef阿燕由于双_
    ) 只要

私人声明子swe_get_planet_name库swedll32.dll_
    别名_swe_get_planet_name @ 8(_
      BYVAL彩光长,_
      BYVAL PNAME作为字符串_
    )

私人声明函数swe_get_planet_name_d库swedll32.dll_
    别名_swe_get_planet_name_d @ 8(_
      BYVAL彩光长,_
      BYVAL PNAME作为字符串_
    ) 只要

私人声明函数swe_get_tid_acc库swedll32.dll_
    别名_swe_get_tid_acc @ 0(_
    )作为双

私人声明函数swe_get_tid_acc_d库swedll32.dll_
    别名_swe_get_tid_acc_d @ 4(_
      为ByRef×如双_
    ) 只要

私人声明函数swe_houses库swedll32.dll_
    别名_swe_houses @ 36(_
      BYVAL tjd_ut作为双,_
      BYVAL geolat作为双,_
      BYVAL geolon作为双,_
      BYVAL ihsy长,_
      为ByRef hcusps作为双,_
      为ByRef ascmc作为双_
    )只要'hcusps必须是第13个数组元素
                    ascmc必须是第10数组元素

私人声明函数swe_houses_d库swedll32.dll_
    别名_swe_houses_d @ 24(_
      为ByRef tjd_ut作为双,_
      为ByRef geolat作为双,_
      为ByRef geolon作为双,_
      BYVAL ihsy长,_
      为ByRef hcusps作为双,_
      为ByRef ascmc作为双_
    )只要'hcusps必须是第13个数组元素
                    ascmc必须是第10数组元素

私人声明函数swe_houses_ex库swedll32.dll_
    别名_swe_houses_ex @ 40(_
      BYVAL tjd_ut作为双,_
      BYVAL IFLAG长,_
      BYVAL geolat作为双,_
      BYVAL geolon作为双,_
      BYVAL ihsy长,_
      为ByRef hcusps作为双,_
      为ByRef ascmc作为双_
    )只要'hcusps必须是第13个数组元素
                    ascmc必须是第10数组元素

私人声明函数swe_houses_ex_d库swedll32.dll_
    别名_swe_houses_ex_d @ 28(_
      为ByRef tjd_ut作为双,_
      BYVAL IFLAG长,_
      为ByRef geolat作为双,_
      为ByRef geolon作为双,_
      BYVAL ihsy长,_
      为ByRef hcusps作为双,_
      为ByRef ascmc作为双_
    )只要'hcusps必须是第13个数组元素
                    ascmc必须是第10数组元素

私人声明函数swe_houses_armc库swedll32.dll_
    别名_swe_houses_armc @ 36(_
      BYVAL ARMC作为双,_
      BYVAL geolat作为双,_
      BYVAL EPS为DOUBLE,_
      BYVAL ihsy长,_
      为ByRef hcusps作为双,_
      为ByRef ascmc作为双_
    )只要'hcusps必须是第13个数组元素
                    ascmc必须是第10数组元素

私人声明函数swe_houses_armc_d库swedll32.dll_
    别名_swe_houses_armc_d @ 24(_
      为ByRef ARMC作为双,_
      为ByRef geolat作为双,_
      ByRef的EPS为DOUBLE,_
      BYVAL ihsy长,_
      为ByRef hcusps作为双,_
      为ByRef ascmc作为双_
    )只要'hcusps必须是第13个数组元素
                    ascmc必须是第10数组元素

私人声明函数swe_house_pos库swedll32.dll_
    别名_swe_house_pos @ 36(_
      BYVAL ARMC作为双,_
      BYVAL geolat作为双,_
      BYVAL EPS为DOUBLE,_
      BYVAL ihsy长,_
      为ByRef xpin作为双,_
      BYVAL SERR作为字符串_
    )作为双
                    xpin必须是第2数组元素

私人声明函数swe_house_pos_d库swedll32.dll_
    别名_swe_house_pos_d @ 28(_
      为ByRef ARMC作为双,_
      为ByRef geolat作为双,_
      ByRef的EPS为DOUBLE,_
      BYVAL ihsy长,_
      为ByRef xpin作为双,_
      为ByRef HPOS作为双,_
      BYVAL SERR作为字符串_
    ) 只要
                    xpin必须是第2数组元素

私人声明函数swe_julday库swedll32.dll_
    别名_swe_julday @ 24(_
      BYVAL一年,龙,_
      BYVAL月长,_
      BYVAL每天只要,_
      BYVAL小时为DOUBLE,_
      BYVAL gregflg只要_
    )作为双

私人声明函数swe_julday_d库swedll32.dll_
    别名_swe_julday_d @ 24(_
      BYVAL一年,龙,_
      BYVAL月长,_
      BYVAL每天只要,_
      为ByRef小时为DOUBLE,_
      BYVAL gregflg长,_
      为ByRef TJD作为双_
    ) 只要

私人声明函数swe_lun_eclipse_how库swedll32.dll_
    别名_swe_lun_eclipse_how @ 24(_
      BYVAL tjd_ut作为双,_
      BYVAL IFL长,_
      为ByRef geopos作为双,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_lun_eclipse_how_d库swedll32.dll_
    别名_swe_lun_eclipse_how_d @ 20(_
      为ByRef tjd_ut作为双,_
      BYVAL IFL长,_
      为ByRef geopos作为双,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_lun_eclipse_when库swedll32.dll_
    别名_swe_lun_eclipse_when @ 28(_
      BYVAL tjd_start作为双,_
      BYVAL IFL长,_
      BYVAL ifltype长,_
      为ByRef TRET作为双,_
      BYVAL向后长,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_lun_eclipse_when_d库swedll32.dll_
    别名_swe_lun_eclipse_when_d @ 24(_
      为ByRef tjd_start作为双,_
      BYVAL IFL长,_
      BYVAL ifltype长,_
      为ByRef TRET作为双,_
      BYVAL向后长,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_nod_aps库swedll32.dll_
    别名_swe_nod_aps @ 40(_
      BYVAL tjd_et作为双,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      BYVAL方法龙_
      为ByRef xnasc作为双,_
      为ByRef xndsc作为双,_
      为ByRef xperi作为双,_
      为ByRef xaphe作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_nod_aps_ut库swedll32.dll_
    别名_swe_nod_aps_ut @ 40(_
      BYVAL tjd_ut作为双,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      BYVAL方法龙_
      为ByRef xnasc作为双,_
      为ByRef xndsc作为双,_
      为ByRef xperi作为双,_
      为ByRef xaphe作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_pheno库swedll32.dll_
    别名_swe_pheno @ 24(_
      BYVAL TJD为DOUBLE,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_pheno_ut库swedll32.dll_
    别名_swe_pheno_ut @ 24(_
      BYVAL TJD为DOUBLE,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_pheno_d库swedll32.dll_
    别名_swe_pheno_d @ 20(_
      为ByRef TJD为DOUBLE,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_pheno_ut_d库swedll32.dll_
    别名_swe_pheno_ut_d @ 20(_
      为ByRef TJD为DOUBLE,_
      BYVAL彩光长,_
      BYVAL IFLAG长,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_refrac库swedll32.dll_
    别名_swe_refrac @ 28(_
      BYVAL inalt作为双,_
      BYVAL为preSS作为双,_
      BYVAL学尝试为DOUBLE,_
      BYVAL calc_flag只要_
    )作为双

私人声明子swe_revjul库swedll32.dll_
    别名_swe_revjul @ 28(_
      BYVAL TJD为DOUBLE,_
      BYVAL gregflg长,_
      ByRef的一年,龙,_
      为ByRef月长,_
      为ByRef每天只要,_
      为ByRef小时作为双_
    )

私人声明函数swe_revjul_d库swedll32.dll_
    别名_swe_revjul_d @ 24(_
      为ByRef TJD为DOUBLE,_
      BYVAL gregflg长,_
      ByRef的一年,龙,_
      为ByRef月长,_
      为ByRef每天只要,_
      为ByRef小时作为双_
    ) 只要

私人声明函数swe_rise_trans库swedll32.dll_
    别名_swe_rise_trans @ 52(_
      BYVAL tjd_ut作为双,_
      BYVAL彩光长,_
      BYVAL starname作为字符串_
      BYVAL epheflag长,_
      BYVAL rsmi长,_
      为ByRef geopos作为双,_
      BYVAL为preSS作为双,_
      BYVAL学尝试为DOUBLE,_
      为ByRef TRET作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明子swe_set_ephe_path库swedll32.dll_
    别名_swe_set_ephe_path @ 4(_
      BYVAL路径作为字符串_
    )

私人声明函数swe_set_ephe_path_d库swedll32.dll_
    别名_swe_set_ephe_path_d @ 4(_
      BYVAL路径作为字符串_
    ) 只要

私人声明子swe_set_jpl_file库swedll32.dll_
    别名_swe_set_jpl_file @ 4(_
      BYVAL文件作为字符串_
    )

私人声明函数swe_set_jpl_file_d库swedll32.dll_
    别名_swe_set_jpl_file_d @ 4(_
      BYVAL文件作为字符串_
    ) 只要

私人声明函数swe_set_sid_mode库swedll32.dll_
    别名_swe_set_sid_mode @ 20(_
      BYVAL sid_mode长,_
      BYVAL T0为DOUBLE,_
      BYVAL ayan_t0作为双_
    ) 只要

私人声明函数swe_set_sid_mode_d库swedll32.dll_
    别名_swe_sid_mode_d @ 12(_
      BYVAL sid_mode长,_
      为ByRef T0为DOUBLE,_
      为ByRef ayan_t0作为双_
    ) 只要

私人声明函数swe_set_topo库swedll32.dll_
    别名_swe_set_topo @ 24(_
      BYVAL geolon作为双,_
      BYVAL geolat作为双,_
      BYVAL高度作为双_
    )

私人声明函数swe_set_topo_d库swedll32.dll_
    别名_swe_set_topo_d @ 12(_
      为ByRef geolon作为双,_
      为ByRef geolat作为双,_
      ByRef的高度作为双_
    )

私人声明子swe_set_tid_acc库swedll32.dll_
    别名_swe_set_tid_acc @ 8(_
      BYVAL×如双_
    )

私人声明函数swe_set_tid_acc_d库swedll32.dll_
    别名_swe_set_tid_acc_d @ 4(_
      为ByRef×如双_
    ) 只要

私人声明函数swe_sidtime0库swedll32.dll_
    别名_swe_sidtime0 @ 24(_
      BYVAL tjd_ut作为双,_
      BYVAL ECL作为双,_
      BYVAL螺母作为双_
    )作为双

私人声明函数swe_sidtime0_d库swedll32.dll_
    别名_swe_sidtime0_d @ 16(_
      为ByRef tjd_ut作为双,_
      为ByRef ECL作为双,_
      为ByRef螺母作为双,_
      为ByRef SIDT作为双_
    ) 只要

私人声明函数swe_sidtime库swedll32.dll_
    别名_swe_sidtime @ 8(_
      BYVAL tjd_ut作为双_
    )作为双

私人声明函数swe_sidtime_d库swedll32.dll_
    别名_swe_sidtime_d @ 8(_
      为ByRef tjd_ut作为双,_
      为ByRef SIDT作为双_
    ) 只要

私人声明函数swe_sol_eclipse_how库swedll32.dll_
    别名_swe_sol_eclipse_how @ 24(_
      BYVAL tjd_ut作为双,_
      BYVAL IFL长,_
      为ByRef geopos作为双,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_how_d库swedll32.dll_
    别名_swe_sol_eclipse_how_d @ 20(_
      为ByRef tjd_ut作为双,_
      BYVAL IFL长,_
      为ByRef geopos作为双,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_when_glob库swedll32.dll_
    别名_swe_sol_eclipse_when_glob @ 28(_
      BYVAL tjd_start作为双,_
      BYVAL IFL长,_
      BYVAL ifltype长,_
      为ByRef TRET作为双,_
      BYVAL向后长,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_when_glob_d库swedll32.dll_
    别名_swe_sol_eclipse_when_glob_d @ 24(_
      为ByRef tjd_start作为双,_
      BYVAL IFL长,_
      BYVAL ifltype长,_
      为ByRef TRET作为双,_
      BYVAL向后长,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_when_loc库swedll32.dll_
    别名_swe_sol_eclipse_when_loc @ 32(_
      BYVAL tjd_start作为双,_
      BYVAL IFL长,_
      为ByRef TRET作为双,_
      为ByRef ATTR作为双,_
      BYVAL向后长,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_when_loc_d库swedll32.dll_
    别名_swe_sol_eclipse_when_loc_d @ 28(_
      为ByRef tjd_start作为双,_
      BYVAL IFL长,_
      为ByRef TRET作为双,_
      为ByRef ATTR作为双,_
      BYVAL向后长,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_where库swedll32.dll_
    别名_swe_sol_eclipse_where @ 24(_
      BYVAL tjd_ut作为双,_
      BYVAL IFL长,_
      为ByRef geopos作为双,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_sol_eclipse_where_d库swedll32.dll_
    别名_swe_sol_eclipse_where_d @ 20(_
      为ByRef tjd_ut作为双,_
      BYVAL IFL长,_
      为ByRef geopos作为双,_
      为ByRef ATTR作为双,_
      BYVAL SERR作为字符串_
    ) 只要

私人声明函数swe_time_equ库swedll32.dll_
    别名_swe_time_equ @ 16(_
      BYVAL tjd_ut作为双,_
      为ByRef E上双,_
      为ByRef SERR作为字符串_
    ) 只要
 

解决方案

我认为,所有你需要为你的功能只需添加PTRSAFE: 即你的第一个函数的第一行应该是这样的:

的私人声明PTRSAFE功能swe_azalt库swedll32.dll...... 

I am using Win8 x64 + Office 2013 x64.

MY PROBLEM:

I have an excel file, which has some modules in it, and works flawlessly in Office (Excel) x86. It uses the Swiss Ephemeris file (swedll32.dll) to do a lot of astronomical calculations.

However, when I try to run it on my end, which is on Excel x64, ASAP it's opened, the VBA editor fires up and gives me the following error:

Compile error:
The code in this project must be updated for use on 64-bit systems.
Please review and update Declare statements and then mark them with the PtrSafe attribute.

As I said above, it works only in 32bit office (Excel) but it won't work in my x64 Excel However there seems to be a workaround but I am too much of a novice to get it.

I am no good in VBA, however, after digging over the Internet, a few websites proposed that for 64bit office (Excel), we should amend (for each declaration) the codes to something like that:

  • Original Statement: Private Declare Function
  • Amended Statement: Private Declare PtrSafe Function

Unfortunately, after adding 'PtrSafe' everywhere, though the VBA errors stopped, but the values are not being displayed/calculated properly in the cells.

From a post on 64 Bit in VBA from Microsoft, it would seem that we also need to modify some of the data types such as:

  • Long → to → LongPtr
  • LongPtr → to → LongLong
  • and some "Long" are supposed to remain the same, depending on what they do.

This website (under "Which Longs should become LongPtr?") gives a clue though, as to how to know which one to modify.

I do not understand a thing about it and have no idea what should be done really to make this work in Office (Excel) x64. Someone who is pretty good at this, kindly please help me. Please.

note:

  • Only the declarations that appeared in red, denoting that they contain errors have been dumped here. The remaining portion of the codes were not pasted here because they appear fine (green colored). If you'd like to have a look at the file, the file can be downloaded here: http://bit.ly/Z8Kqm9
  • For the Excel file to work properly on your computer, ensure that both the 'swedll32.dll' & the 'JCalc Ver 0.2d.xls' are in the same folder, after having extracting them.

Problem in Module Name: MainCalculations

'Swiss Ephemeris Release 1.60  9-jan-2000
'
' Declarations for Visual Basic 5.0
' The DLL file must exist in the same directory, or in a system
' directory where it can be found at runtime
'

    Private Declare Function swe_azalt Lib "swedll32.dll" _
    Alias "_swe_azalt@40" ( _
      ByVal tjd_ut As Double, _
      ByVal calc_flag As Long, _
      ByRef geopos As Double, _
      ByVal atpress As Double, _
      ByVal attemp As Double, _
      ByRef xin As Double, _
      ByRef xaz As Double _
    ) As Long  'geopos must be the first of three array elements
               'xin must be the first of two array elements
               'xaz must be the first of three array elements

    Private Declare Function swe_azalt_rev Lib "swedll32.dll" _
    Alias "_swe_azalt_rev@24" ( _
      ByVal tjd_ut As Double, _
      ByVal calc_flag As Long, _
      ByRef geopos As Double, _
      ByRef xin As Double, _
      ByRef xout As Double _
    ) As Long  'geopos must be the first of three array elements
               'xin must be the first of two array elements
               'xout must be the first of three array elements

Private Declare Function swe_calc Lib "swedll32.dll" _
    Alias "_swe_calc@24" ( _
      ByVal tjd As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long   ' x must be first of six array elements
                ' serr must be able to hold 256 bytes

Private Declare Function swe_calc_d Lib "swedll32.dll" _
    Alias "_swe_calc_d@20" ( _
      ByRef tjd As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long       ' x must be first of six array elements
                    ' serr must be able to hold 256 bytes

Private Declare Function swe_calc_ut Lib "swedll32.dll" _
    Alias "_swe_calc_ut@24" ( _
      ByVal tjd_ut As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long   ' x must be first of six array elements
                ' serr must be able to hold 256 bytes

Private Declare Function swe_calc_ut_d Lib "swedll32.dll" _
    Alias "_swe_calc_ut_d@20" ( _
      ByRef tjd_ut As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long       ' x must be first of six array elements
                    ' serr must be able to hold 256 bytes

Private Declare Function swe_close Lib "swedll32.dll" _
    Alias "_swe_close@0" ( _
    ) As Long

Private Declare Function swe_close_d Lib "swedll32.dll" _
    Alias "_swe_close_d@4" ( _
      ByVal ivoid As Long _
    ) As Long       ' argument ivoid is ignored

Private Declare Sub swe_cotrans Lib "swedll32.dll" _
    Alias "_swe_cotrans@16" ( _
      ByRef xpo As Double, _
      ByRef xpn As Double, _
      ByVal eps As Double _
    )

Private Declare Function swe_cotrans_d Lib "swedll32.dll" _
    Alias "_swe_cotrans_d@12" ( _
      ByRef xpo As Double, _
      ByRef xpn As Double, _
      ByRef eps As Double _
    ) As Long

Private Declare Sub swe_cotrans_sp Lib "swedll32.dll" _
    Alias "_swe_cotrans_sp@16" ( _
      ByRef xpo As Double, _
      ByRef xpn As Double, _
      ByVal eps As Double _
    )

Private Declare Function swe_cotrans_sp_d Lib "swedll32.dll" _
    Alias "_swe_cotrans_sp_d@12" ( _
      ByRef xpo As Double, _
      ByRef xpn As Double, _
      ByRef eps As Double _
    ) As Long

Private Declare Sub swe_cs2degstr Lib "swedll32.dll" _
    Alias "_swe_cs2degstr@8" ( _
      ByVal t As Long, _
      ByVal S As String _
    )

Private Declare Function swe_cs2degstr_d Lib "swedll32.dll" _
    Alias "_swe_cs2degstr_d@8" ( _
      ByVal t As Long, _
      ByVal S As String _
    ) As Long

Private Declare Sub swe_cs2lonlatstr Lib "swedll32.dll" _
    Alias "_swe_cs2lonlatstr@16" ( _
      ByVal t As Long, _
      ByVal pchar As Byte, _
      ByVal mchar As Byte, _
      ByVal S As String _
    )

Private Declare Function swe_cs2lonlatstr_d Lib "swedll32.dll" _
    Alias "_swe_cs2lonlatstr_d@16" ( _
      ByVal t As Long, _
      ByRef pchar As Byte, _
      ByRef mchar As Byte, _
      ByVal S As String _
    ) As Long

Private Declare Sub swe_cs2timestr Lib "swedll32.dll" _
    Alias "_swe_cs2timestr@16" ( _
      ByVal t As Long, _
      ByVal sep As Long, _
      ByVal supzero As Long, _
      ByVal S As String _
    )

Private Declare Function swe_cs2timestr_d Lib "swedll32.dll" _
    Alias "_swe_cs2timestr_d@16" ( _
      ByVal t As Long, _
      ByVal sep As Long, _
      ByVal supzero As Long, _
      ByVal S As String _
    ) As Long

Private Declare Function swe_csnorm Lib "swedll32.dll" _
    Alias "_swe_csnorm@4" ( _
      ByVal P As Long _
    ) As Long

Private Declare Function swe_csnorm_d Lib "swedll32.dll" _
    Alias "_swe_csnorm_d@4" ( _
      ByVal P As Long _
    ) As Long

Private Declare Function swe_csroundsec Lib "swedll32.dll" _
    Alias "_swe_csroundsec@4" ( _
      ByVal P As Long _
    ) As Long

Private Declare Function swe_csroundsec_d Lib "swedll32.dll" _
    Alias "_swe_csroundsec_d@4" ( _
      ByVal P As Long _
    ) As Long

Private Declare Function swe_d2l Lib "swedll32.dll" _
    Alias "_swe_d2l@8" ( _
    ) As Long

Private Declare Function swe_d2l_d Lib "swedll32.dll" _
    Alias "_swe_d2l_d@4" ( _
    ) As Long

Private Declare Function swe_date_conversion Lib "swedll32.dll" _
    Alias "_swe_date_conversion@28" ( _
      ByVal Year As Long, _
      ByVal Month As Long, _
      ByVal Day As Long, _
      ByVal utime As Double, _
      ByVal cal As Byte, _
      ByRef tjd As Double _
    ) As Long

Private Declare Function swe_date_conversion_d Lib "swedll32.dll" _
    Alias "_swe_date_conversion_d@24" ( _
      ByVal Year As Long, _
      ByVal Month As Long, _
      ByVal Day As Long, _
      ByRef utime As Double, _
      ByRef cal As Byte, _
      ByRef tjd As Double _
    ) As Long

Private Declare Function swe_day_of_week Lib "swedll32.dll" _
    Alias "_swe_day_of_week@8" ( _
      ByVal JD As Double _
    ) As Long

Private Declare Function swe_day_of_week_d Lib "swedll32.dll" _
    Alias "_swe_day_of_week_d@4" ( _
      ByRef JD As Double _
    ) As Long

Private Declare Function swe_degnorm Lib "swedll32.dll" _
    Alias "_swe_degnorm@8" ( _
      ByVal JD As Double _
    ) As Double

Private Declare Function swe_degnorm_d Lib "swedll32.dll" _
    Alias "_swe_degnorm_d@4" ( _
      ByRef JD As Double _
    ) As Long

Private Declare Function swe_deltat Lib "swedll32.dll" _
    Alias "_swe_deltat@8" ( _
      ByVal JD As Double _
    ) As Double

Private Declare Function swe_deltat_d Lib "swedll32.dll" _
    Alias "_swe_deltat_d@8" ( _
      ByRef JD As Double, _
      ByRef deltat As Double _
    ) As Long

Private Declare Function swe_difcs2n Lib "swedll32.dll" _
    Alias "_swe_difcs2n@8" ( _
      ByVal p1 As Long, _
      ByVal p2 As Long _
    ) As Long

Private Declare Function swe_difcs2n_d Lib "swedll32.dll" _
    Alias "_swe_difcs2n_d@8" ( _
      ByVal p1 As Long, _
      ByVal p2 As Long _
    ) As Long

Private Declare Function swe_difcsn Lib "swedll32.dll" _
    Alias "_swe_difcsn@8" ( _
      ByVal p1 As Long, _
      ByVal p2 As Long _
    ) As Long

Private Declare Function swe_difcsn_d Lib "swedll32.dll" _
    Alias "_swe_difcsn_d@8" ( _
      ByVal p1 As Long, _
      ByVal p2 As Long _
    ) As Long

Private Declare Function swe_difdeg2n Lib "swedll32.dll" _
    Alias "_swe_difdeg2n@16" ( _
      ByVal p1 As Double, _
      ByVal p2 As Double _
    ) As Double

Private Declare Function swe_difdeg2n_d Lib "swedll32.dll" _
    Alias "_swe_difdeg2n_d@12" ( _
      ByRef p1 As Double, _
      ByRef p2 As Double, _
      ByRef Diff As Double _
    ) As Long

Private Declare Function swe_difdegn Lib "swedll32.dll" _
    Alias "_swe_difdegn@16" ( _
      ByVal p1 As Double, _
      ByVal p2 As Double _
    ) As Long

Private Declare Function swe_difdegn_d Lib "swedll32.dll" _
    Alias "_swe_difdegn_d@12" ( _
      ByRef p1 As Double, _
      ByRef p2 As Double, _
      ByRef Diff As Double _
    ) As Long

Private Declare Function swe_fixstar Lib "swedll32.dll" _
    Alias "_swe_fixstar@24" ( _
      ByVal star As String, _
      ByVal tjd As Double, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long       ' x must be first of six array elements
                    ' serr must be able to hold 256 bytes
                    ' star must be able to hold 40 bytes

Private Declare Function swe_fixstar_d Lib "swedll32.dll" _
    Alias "_swe_fixstar_d@20" ( _
      ByVal star As String, _
      ByRef tjd As Double, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long       ' x must be first of six array elements
                    ' serr must be able to hold 256 bytes
                    ' star must be able to hold 40 bytes

Private Declare Function swe_fixstar_ut Lib "swedll32.dll" _
    Alias "_swe_fixstar_ut@24" ( _
      ByVal star As String, _
      ByVal tjd_ut As Double, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long       ' x must be first of six array elements
                    ' serr must be able to hold 256 bytes
                    ' star must be able to hold 40 bytes

Private Declare Function swe_fixstar_ut_d Lib "swedll32.dll" _
    Alias "_swe_fixstar_ut_d@20" ( _
      ByVal star As String, _
      ByRef tjd_ut As Double, _
      ByVal iflag As Long, _
      ByRef X As Double, _
      ByVal serr As String _
    ) As Long       ' x must be first of six array elements
                    ' serr must be able to hold 256 bytes
                    ' star must be able to hold 40 bytes

Private Declare Function swe_get_ayanamsa Lib "swedll32.dll" _
    Alias "_swe_get_ayanamsa@8" ( _
      ByVal tjd_et As Double _
    ) As Double

Private Declare Function swe_get_ayanamsa_d Lib "swedll32.dll" _
    Alias "_swe_get_ayanamsa_d@8" ( _
      ByRef tjd_et As Double, _
      ByRef ayan As Double _
    ) As Long

Private Declare Function swe_get_ayanamsa_ut Lib "swedll32.dll" _
    Alias "_swe_get_ayanamsa_ut@8" ( _
      ByVal tjd_ut As Double _
    ) As Double

Private Declare Function swe_get_ayanamsa_ut_d Lib "swedll32.dll" _
    Alias "_swe_get_ayanamsa_ut_d@8" ( _
      ByRef tjd_ut As Double, _
      ByRef ayan As Double _
    ) As Long

Private Declare Sub swe_get_planet_name Lib "swedll32.dll" _
    Alias "_swe_get_planet_name@8" ( _
      ByVal ipl As Long, _
      ByVal pname As String _
    )

Private Declare Function swe_get_planet_name_d Lib "swedll32.dll" _
    Alias "_swe_get_planet_name_d@8" ( _
      ByVal ipl As Long, _
      ByVal pname As String _
    ) As Long

Private Declare Function swe_get_tid_acc Lib "swedll32.dll" _
    Alias "_swe_get_tid_acc@0" ( _
    ) As Double

Private Declare Function swe_get_tid_acc_d Lib "swedll32.dll" _
    Alias "_swe_get_tid_acc_d@4" ( _
      ByRef X As Double _
    ) As Long

Private Declare Function swe_houses Lib "swedll32.dll" _
    Alias "_swe_houses@36" ( _
      ByVal tjd_ut As Double, _
      ByVal geolat As Double, _
      ByVal geolon As Double, _
      ByVal ihsy As Long, _
      ByRef hcusps As Double, _
      ByRef ascmc As Double _
    ) As Long       ' hcusps must be first of 13 array elements
                    ' ascmc must be first of 10 array elements

Private Declare Function swe_houses_d Lib "swedll32.dll" _
    Alias "_swe_houses_d@24" ( _
      ByRef tjd_ut As Double, _
      ByRef geolat As Double, _
      ByRef geolon As Double, _
      ByVal ihsy As Long, _
      ByRef hcusps As Double, _
      ByRef ascmc As Double _
    ) As Long       ' hcusps must be first of 13 array elements
                    ' ascmc must be first of 10 array elements

Private Declare Function swe_houses_ex Lib "swedll32.dll" _
    Alias "_swe_houses_ex@40" ( _
      ByVal tjd_ut As Double, _
      ByVal iflag As Long, _
      ByVal geolat As Double, _
      ByVal geolon As Double, _
      ByVal ihsy As Long, _
      ByRef hcusps As Double, _
      ByRef ascmc As Double _
    ) As Long       ' hcusps must be first of 13 array elements
                    ' ascmc must be first of 10 array elements

Private Declare Function swe_houses_ex_d Lib "swedll32.dll" _
    Alias "_swe_houses_ex_d@28" ( _
      ByRef tjd_ut As Double, _
      ByVal iflag As Long, _
      ByRef geolat As Double, _
      ByRef geolon As Double, _
      ByVal ihsy As Long, _
      ByRef hcusps As Double, _
      ByRef ascmc As Double _
    ) As Long       ' hcusps must be first of 13 array elements
                    ' ascmc must be first of 10 array elements

Private Declare Function swe_houses_armc Lib "swedll32.dll" _
    Alias "_swe_houses_armc@36" ( _
      ByVal armc As Double, _
      ByVal geolat As Double, _
      ByVal eps As Double, _
      ByVal ihsy As Long, _
      ByRef hcusps As Double, _
      ByRef ascmc As Double _
    ) As Long       ' hcusps must be first of 13 array elements
                    ' ascmc must be first of 10 array elements

Private Declare Function swe_houses_armc_d Lib "swedll32.dll" _
    Alias "_swe_houses_armc_d@24" ( _
      ByRef armc As Double, _
      ByRef geolat As Double, _
      ByRef eps As Double, _
      ByVal ihsy As Long, _
      ByRef hcusps As Double, _
      ByRef ascmc As Double _
    ) As Long       ' hcusps must be first of 13 array elements
                    ' ascmc must be first of 10 array elements

Private Declare Function swe_house_pos Lib "swedll32.dll" _
    Alias "_swe_house_pos@36" ( _
      ByVal armc As Double, _
      ByVal geolat As Double, _
      ByVal eps As Double, _
      ByVal ihsy As Long, _
      ByRef xpin As Double, _
      ByVal serr As String _
    ) As Double
                    ' xpin must be first of 2 array elements

Private Declare Function swe_house_pos_d Lib "swedll32.dll" _
    Alias "_swe_house_pos_d@28" ( _
      ByRef armc As Double, _
      ByRef geolat As Double, _
      ByRef eps As Double, _
      ByVal ihsy As Long, _
      ByRef xpin As Double, _
      ByRef hpos As Double, _
      ByVal serr As String _
    ) As Long
                    ' xpin must be first of 2 array elements

Private Declare Function swe_julday Lib "swedll32.dll" _
    Alias "_swe_julday@24" ( _
      ByVal Year As Long, _
      ByVal Month As Long, _
      ByVal Day As Long, _
      ByVal hour As Double, _
      ByVal gregflg As Long _
    ) As Double

Private Declare Function swe_julday_d Lib "swedll32.dll" _
    Alias "_swe_julday_d@24" ( _
      ByVal Year As Long, _
      ByVal Month As Long, _
      ByVal Day As Long, _
      ByRef hour As Double, _
      ByVal gregflg As Long, _
      ByRef tjd As Double _
    ) As Long

Private Declare Function swe_lun_eclipse_how Lib "swedll32.dll" _
    Alias "_swe_lun_eclipse_how@24" ( _
      ByVal tjd_ut As Double, _
      ByVal ifl As Long, _
      ByRef geopos As Double, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_lun_eclipse_how_d Lib "swedll32.dll" _
    Alias "_swe_lun_eclipse_how_d@20" ( _
      ByRef tjd_ut As Double, _
      ByVal ifl As Long, _
      ByRef geopos As Double, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_lun_eclipse_when Lib "swedll32.dll" _
    Alias "_swe_lun_eclipse_when@28" ( _
      ByVal tjd_start As Double, _
      ByVal ifl As Long, _
      ByVal ifltype As Long, _
      ByRef tret As Double, _
      ByVal backward As Long, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_lun_eclipse_when_d Lib "swedll32.dll" _
    Alias "_swe_lun_eclipse_when_d@24" ( _
      ByRef tjd_start As Double, _
      ByVal ifl As Long, _
      ByVal ifltype As Long, _
      ByRef tret As Double, _
      ByVal backward As Long, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_nod_aps Lib "swedll32.dll" _
    Alias "_swe_nod_aps@40" ( _
      ByVal tjd_et As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByVal method As Long, _
      ByRef xnasc As Double, _
      ByRef xndsc As Double, _
      ByRef xperi As Double, _
      ByRef xaphe As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_nod_aps_ut Lib "swedll32.dll" _
    Alias "_swe_nod_aps_ut@40" ( _
      ByVal tjd_ut As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByVal method As Long, _
      ByRef xnasc As Double, _
      ByRef xndsc As Double, _
      ByRef xperi As Double, _
      ByRef xaphe As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_pheno Lib "swedll32.dll" _
    Alias "_swe_pheno@24" ( _
      ByVal tjd As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_pheno_ut Lib "swedll32.dll" _
    Alias "_swe_pheno_ut@24" ( _
      ByVal tjd As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_pheno_d Lib "swedll32.dll" _
    Alias "_swe_pheno_d@20" ( _
      ByRef tjd As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_pheno_ut_d Lib "swedll32.dll" _
    Alias "_swe_pheno_ut_d@20" ( _
      ByRef tjd As Double, _
      ByVal ipl As Long, _
      ByVal iflag As Long, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_refrac Lib "swedll32.dll" _
    Alias "_swe_refrac@28" ( _
      ByVal inalt As Double, _
      ByVal atpress As Double, _
      ByVal attemp As Double, _
      ByVal calc_flag As Long _
    ) As Double

Private Declare Sub swe_revjul Lib "swedll32.dll" _
    Alias "_swe_revjul@28" ( _
      ByVal tjd As Double, _
      ByVal gregflg As Long, _
      ByRef Year As Long, _
      ByRef Month As Long, _
      ByRef Day As Long, _
      ByRef hour As Double _
    )

Private Declare Function swe_revjul_d Lib "swedll32.dll" _
    Alias "_swe_revjul_d@24" ( _
      ByRef tjd As Double, _
      ByVal gregflg As Long, _
      ByRef Year As Long, _
      ByRef Month As Long, _
      ByRef Day As Long, _
      ByRef hour As Double _
    ) As Long

Private Declare Function swe_rise_trans Lib "swedll32.dll" _
    Alias "_swe_rise_trans@52" ( _
      ByVal tjd_ut As Double, _
      ByVal ipl As Long, _
      ByVal starname As String, _
      ByVal epheflag As Long, _
      ByVal rsmi As Long, _
      ByRef geopos As Double, _
      ByVal atpress As Double, _
      ByVal attemp As Double, _
      ByRef tret As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Sub swe_set_ephe_path Lib "swedll32.dll" _
    Alias "_swe_set_ephe_path@4" ( _
      ByVal path As String _
    )

Private Declare Function swe_set_ephe_path_d Lib "swedll32.dll" _
    Alias "_swe_set_ephe_path_d@4" ( _
      ByVal path As String _
    ) As Long

Private Declare Sub swe_set_jpl_file Lib "swedll32.dll" _
    Alias "_swe_set_jpl_file@4" ( _
      ByVal file As String _
    )

Private Declare Function swe_set_jpl_file_d Lib "swedll32.dll" _
    Alias "_swe_set_jpl_file_d@4" ( _
      ByVal file As String _
    ) As Long

Private Declare Function swe_set_sid_mode Lib "swedll32.dll" _
    Alias "_swe_set_sid_mode@20" ( _
      ByVal sid_mode As Long, _
      ByVal t0 As Double, _
      ByVal ayan_t0 As Double _
    ) As Long

Private Declare Function swe_set_sid_mode_d Lib "swedll32.dll" _
    Alias "_swe_sid_mode_d@12" ( _
      ByVal sid_mode As Long, _
      ByRef t0 As Double, _
      ByRef ayan_t0 As Double _
    ) As Long

Private Declare Function swe_set_topo Lib "swedll32.dll" _
    Alias "_swe_set_topo@24" ( _
      ByVal geolon As Double, _
      ByVal geolat As Double, _
      ByVal altitude As Double _
    )

Private Declare Function swe_set_topo_d Lib "swedll32.dll" _
    Alias "_swe_set_topo_d@12" ( _
      ByRef geolon As Double, _
      ByRef geolat As Double, _
      ByRef altitude As Double _
    )

Private Declare Sub swe_set_tid_acc Lib "swedll32.dll" _
    Alias "_swe_set_tid_acc@8" ( _
      ByVal X As Double _
    )

Private Declare Function swe_set_tid_acc_d Lib "swedll32.dll" _
    Alias "_swe_set_tid_acc_d@4" ( _
      ByRef X As Double _
    ) As Long

Private Declare Function swe_sidtime0 Lib "swedll32.dll" _
    Alias "_swe_sidtime0@24" ( _
      ByVal tjd_ut As Double, _
      ByVal ecl As Double, _
      ByVal nut As Double _
    ) As Double

Private Declare Function swe_sidtime0_d Lib "swedll32.dll" _
    Alias "_swe_sidtime0_d@16" ( _
      ByRef tjd_ut As Double, _
      ByRef ecl As Double, _
      ByRef nut As Double, _
      ByRef sidt As Double _
    ) As Long

Private Declare Function swe_sidtime Lib "swedll32.dll" _
    Alias "_swe_sidtime@8" ( _
      ByVal tjd_ut As Double _
    ) As Double

Private Declare Function swe_sidtime_d Lib "swedll32.dll" _
    Alias "_swe_sidtime_d@8" ( _
      ByRef tjd_ut As Double, _
      ByRef sidt As Double _
    ) As Long

Private Declare Function swe_sol_eclipse_how Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_how@24" ( _
      ByVal tjd_ut As Double, _
      ByVal ifl As Long, _
      ByRef geopos As Double, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_how_d Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_how_d@20" ( _
      ByRef tjd_ut As Double, _
      ByVal ifl As Long, _
      ByRef geopos As Double, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_when_glob Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_when_glob@28" ( _
      ByVal tjd_start As Double, _
      ByVal ifl As Long, _
      ByVal ifltype As Long, _
      ByRef tret As Double, _
      ByVal backward As Long, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_when_glob_d Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_when_glob_d@24" ( _
      ByRef tjd_start As Double, _
      ByVal ifl As Long, _
      ByVal ifltype As Long, _
      ByRef tret As Double, _
      ByVal backward As Long, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_when_loc Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_when_loc@32" ( _
      ByVal tjd_start As Double, _
      ByVal ifl As Long, _
      ByRef tret As Double, _
      ByRef attr As Double, _
      ByVal backward As Long, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_when_loc_d Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_when_loc_d@28" ( _
      ByRef tjd_start As Double, _
      ByVal ifl As Long, _
      ByRef tret As Double, _
      ByRef attr As Double, _
      ByVal backward As Long, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_where Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_where@24" ( _
      ByVal tjd_ut As Double, _
      ByVal ifl As Long, _
      ByRef geopos As Double, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_sol_eclipse_where_d Lib "swedll32.dll" _
    Alias "_swe_sol_eclipse_where_d@20" ( _
      ByRef tjd_ut As Double, _
      ByVal ifl As Long, _
      ByRef geopos As Double, _
      ByRef attr As Double, _
      ByVal serr As String _
    ) As Long

Private Declare Function swe_time_equ Lib "swedll32.dll" _
    Alias "_swe_time_equ@16" ( _
      ByVal tjd_ut As Double, _
      ByRef E As Double, _
      ByRef serr As String _
    ) As Long

解决方案

I think all you need to do for your function is just add PtrSafe: i.e. the first line of your first function should look like this:

Private Declare PtrSafe Function swe_azalt Lib "swedll32.dll" ......

这篇关于Excel中VBA code:在x64版本的编译错误(需要'PTRSAFE'属性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆