在WPS中使用VBA7 (转http://blog.chinaunix.net/uid-20104422-id-3028698.html)

Coordinator
Nov 26, 2012 at 1:52 AM
在WPS中使用VBA7 (2011-11-27 09:19)
分类: Office



从Microsoft Shared和SYSTEM32中提取出vba及其依赖的基本文件,复制并设置注册表
后,即可让WPS 2012使用VBA7。但似乎WPS2012只认放在OFFICE10中的MSO.dll。
所需的文件有:
VBA目录(只需VBA6、VBA7中的VBE6EXT.OLB,VBE7.DLL和2052),
Office10目录(只需MSO.DLL及1033或2052目录下msointl.dll,可取最新版本),
SYSTEM32下FM20.DLL,FM20CHS.DLL,FM20ENU.DLL文件,
提取之后运行批处理脚本SET.BAT自动复制和设置。
在WIN XP中双击SET.BAT,在Win7中需在SET.BAT上点右键,以管理员身份运行。
WPS 2012中:ALT + F8 运行宏,ALT + F11 打开宏编辑器。
http://ishare.iask.sina.com.cn/f/21438380.html

SET.BAT中的批处理命令:
MD "%CommonProgramFiles%\Microsoft Shared\office10"
MD "%CommonProgramFiles%\Microsoft Shared\vba"
XCOPY /I /S /-Y %~dp0\OFFICE10 "%CommonProgramFiles%\Microsoft Shared\office10"
XCOPY /I /S /-Y %~dp0\VBA "%CommonProgramFiles%\Microsoft Shared\vba"
XCOPY /I /S /-Y %~dp0\SYSTEM32 "%SystemRoot%\System32\"
REG IMPORT %~dp0\VBA7.REG
REGSVR32 /S "%CommonProgramFiles%\Microsoft Shared\VBA\VBA7\VBE7.DLL"
REGSVR32 /S "%SystemRoot%\System32\fm20.dll"
@echo "文件已复制。注册表文件已导入。DLL已登记。"
@pause


VBE7.REG中的内容:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBA]
"Vbe6DllPath"="C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA7\\VBE7.DLL"
"Vbe7DllPath"="C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA7\\VBE7.DLL"


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{0002E157-0000-0000-C000-000000000046}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{0002E157-0000-0000-C000-000000000046}\5.3]
"PrimaryInteropAssemblyName"="Microsoft.Vbe.Interop, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
@="Microsoft Visual Basic for Applications Extensibility 5.3"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{0002E157-0000-0000-C000-000000000046}\5.3\0]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{0002E157-0000-0000-C000-000000000046}\5.3\0\win32]
@="C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.OLB"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{0002E157-0000-0000-C000-000000000046}\5.3\FLAGS]
@="0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{0002E157-0000-0000-C000-000000000046}\5.3\HELPDIR]
@="[{0002E157-0000-0000-C000-000000000046}]"


[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1]

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1]
@="Visual Basic For Applications"

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\9]

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\9\win32]

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\9\win32]
@="C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA7\\VBE7.DLL"

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\FLAGS]

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\FLAGS]
@="0"

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\HELPDIR]

[HKEY_CLASSES_ROOT\TypeLib\{000204EF-0000-0000-C000-000000000046}\4.1\HELPDIR]
@="C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA7"