在2007年使用LoadCustomUI for Ribbons,但需要能够在2003年进行编译 [英] Using LoadCustomUI for Ribbons in 2007, but need to be able tocompile in 2003

查看:53
本文介绍了在2007年使用LoadCustomUI for Ribbons,但需要能够在2003年进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序可以在Access 2000中通过Access 2007运行

以适应我的客户的各种环境。我实现了代码

来调用一个函数,该函数使用LoadCustomUI方法加载我的

自定义功能区用于Access 2007.此功能仅在
$时调用b $ b检查运行Access版本12或更高版本是真的。


一切都像我想要的Access 2007.问题是当我

编译它在Access 2000,2002,2003上,LoadCustomUI方法导致

错误,指示找不到方法或数据成员(因为它显然是新的/ b
)。我试图将LoadCustomUI定义为一个对象,但是

无法让它工作。


有没有办法让它变成在Access 2003上编译,除了

注释掉LoadCustomUI调用?


感谢您的任何建议。

I have an application that runs in any of Access 2000 thru Access 2007
to accommodate my customers'' various environments. I implemented code
to call a function that uses the LoadCustomUI method to load in my
custom ribbon for Access 2007. This function is called only when the
check for running Access version 12 or higher is true.

Everything works like I want in Access 2007. The problem is when I
compile it on Access 2000,2002,2003, the LoadCustomUI method causes an
error indicating method or data member not found (because it is new to
2007 obviously). I tried to define LoadCustomUI as an object, but
haven''t been able to get that to work.

Is there any way to get this to compile on Access 2003 aside from
commenting out the LoadCustomUI call?

Thanks for any suggestions.

推荐答案

你可以使用Access 2000和2002的条件编译,但是如果你使用它来获取Access 2003的
你将无法将它转换为mde文件如果你有
sp1或更少。不知道它是否已在以后的服务包上修复。示例:


(使用自定义函数确定它是否由Access 2007编译。)


dim isAccess2007 as boolean


isAccess2007 = funcDBisAccess2007()


#if isAccess2007 = true然后

... LoadCustomUI ...

#end如果


如果您需要在Access 2003中转换为mde,请尝试使用sp2或sp3并查看

if有用。如果你不需要注释掉条件编译

指令和LoadCustomUI代码,但只适用于Access 2003.

条件编译代码适用于早期版本版本''mde转换。


如果你需要mdes的替代方法是转换为Access 2000 db格式和

将其转换为Access 2000中的mde并运行它在其他版本的Access中。

Chris

Microsoft MVP

KW写道:
You can use a conditional compile for Access 2000 and 2002, but if you use it
for Access 2003 you won''t be able to convert it into an mde file if you have
sp1 or less. Don''t know if it''s fixed on later service packs. Example:

(Use a custom function to determine if it''s being compiled by Access 2007.)

dim isAccess2007 as boolean

isAccess2007 = funcDBisAccess2007()

#if isAccess2007 = true then
... LoadCustomUI ...
#end if

If you need to convert to mde in Access 2003, try it with sp2 or sp3 and see
if it works. If it doesn''t you need to comment out the conditional compile
instructions and the LoadCustomUI code, but only for Access 2003. The
conditional compilation code works for the earlier versions'' mde conversions.

An alternative if you require mdes is to convert to Access 2000 db format and
convert that to mde in Access 2000 and run it in the other versions of Access.
Chris
Microsoft MVP
KW wrote:

>我有一个应用程序可以在Access 2000中通过Access 2007运行
以适应我的客户的各种环境。我实现了代码来调用一个函数,该函数使用LoadCustomUI方法加载我的用于Access 2007的自定义功能区。只有在检查运行Access版本12或更高版本时才调用此函数。真的。

一切都像我在Access 2007中那样工作。问题是当我在Access 2000,2002,2003上编译它时,LoadCustomUI方法会导致
错误指示方法或未找到数据成员(因为它显然是2007年新的)。我试图将LoadCustomUI定义为一个对象,但是还没有能够让它工作。

除了
>I have an application that runs in any of Access 2000 thru Access 2007
to accommodate my customers'' various environments. I implemented code
to call a function that uses the LoadCustomUI method to load in my
custom ribbon for Access 2007. This function is called only when the
check for running Access version 12 or higher is true.

Everything works like I want in Access 2007. The problem is when I
compile it on Access 2000,2002,2003, the LoadCustomUI method causes an
error indicating method or data member not found (because it is new to
2007 obviously). I tried to define LoadCustomUI as an object, but
haven''t been able to get that to work.

Is there any way to get this to compile on Access 2003 aside from
commenting out the LoadCustomUI call?



-

通过AccessMonster.com发布消息
http://www.accessmonster.com/Uwe/For...ccess/200810/1

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200810/1


听起来很有前途,它现在可以在Access 2003上编译,但是当我将mde移动到的时候是

Access 2007并在那里运行,它没有
执行调用LoadCustomUI的代码。我从来没有完成过有条件的编译,所以我可能会有一个误解。以下是

代码的片段:


Dim is2007 As Boolean


is2007 = IsAccess2007()


#If is2007 = True然后

......

......

Application.LoadCustomUI recSet!RibbonName,recSet!RibbonXml

......

......

#End如果


退出功能

......

......

函数IsAccess2007()为布尔值

如果为Left(Application.Version,2)=" 12"然后

IsAccess2007 =真

否则

IsAccess2007 = False

结束如果


结束功能


谢谢。

KW
That sounds promising, and it does compile on Access 2003 now, but
when I move the mde to Access 2007 and run it there, it does not
execute the code to call LoadCustomUI. I''ve never done conditional
compiles, so I may have a miunderstanding. Here are snippets of the
code:

Dim is2007 As Boolean

is2007 = IsAccess2007()

#If is2007 = True Then
......
......
Application.LoadCustomUI recSet!RibbonName, recSet!RibbonXml
......
......
#End If

Exit Function
......
......
Function IsAccess2007() As Boolean

If Left(Application.Version, 2) = "12" Then
IsAccess2007 = True
Else
IsAccess2007 = False
End If

End Function

Thanks.
KW


为避免出现问题,你应该*在运行任何代码之前,总是*在运行的版本中编译

。这不适用于mde和accde文件,因为

代码已经编译好了。


具体来说,当你因版本限制而有条件地编译时,< br *>
你*必须*编译*那*版本。


您需要在Access 2007中编译将在Access 2007中运行的应用程序,

您需要在Access 2000中编译将在Access 2000等中运行的应用程序。

由于条件编译命令'正在检查Access

2007版本,在Access 2000中编译的db将在2000,2002和2003中运行,

但不是2007(因为在Access 2000中编译时is2007是错误的)。

但就像我说的那样,你应该为你运行的版本编译vba代码,以避免库等问题。


Chris

Microsoft MVP


KW写道:
To avoid problems, you should *always* compile in the version you''re running
before running any code. That doesn''t apply to mde and accde files because
the code is already compiled.

Specifically, when you conditionally compile because of version limitations,
you *must* compile for *that* version.

You need to compile in Access 2007 for the apps that will run in Access 2007,
you need to compile in Access 2000 for apps that will run in Access 2000, etc.
Because of the conditional compile command that''s checking for the Access
2007 version, the db compiled in Access 2000 will run in 2000, 2002 and 2003,
but not 2007 (because is2007 was false when it was compiled in Access 2000).
But like I said, you should compile the vba code for the version you''re
running to avoid problems with libraries, etc.

Chris
Microsoft MVP

KW wrote:

>听起来很有希望,它现在可以在Access 2003上编译,但是当我将mde移动到Access 2007并在那里运行时,它不会执行调用LoadCustomUI的代码。
>That sounds promising, and it does compile on Access 2003 now, but
when I move the mde to Access 2007 and run it there, it does not
execute the code to call LoadCustomUI.



-

通过AccessMonster.com发布消息
http://www.accessmonster.com/Uwe/For...ccess/200810/1

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200810/1


这篇关于在2007年使用LoadCustomUI for Ribbons,但需要能够在2003年进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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