以编程方式从* .cls或类似文件将模块导入访问 [英] Importing a module into access programmatically from a *.cls or similar file

查看:98
本文介绍了以编程方式从* .cls或类似文件将模块导入访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果打开Microsoft Access,则打开可视的基本窗口,以便您可以查看Access项目中的模块和代码列表.您可以从Windows资源管理器中拖动基于文本的文件(txt,cls,bas等),并将其拖放到模块文件夹中.

If you open Microsoft Access, then open the visual basic window so you can see the list of modules and code in your Access project. You can drag a text-based file (txt, cls, bas, etc) from windows explorer and drop it into your module folder.

此拖放操作会将基于文本的文件中的代码导入到您的项目中,并提示您保存它(默认名称是您拖放的文件的名称.

This drag and drop action will import the code in the text-based file into your project and prompt you to save it (with the default name being the name of the file you dropped.

有没有一种方法可以使用VBA进行编程?看起来似乎应该是一个简单的任务,应该有一个简单的解决方案,但是我已经研究了好几天,而且似乎找不到一种简单的方法来完成它.

Is there a way to do this programmatically using VBA? It seems like a simple task that should have a simple solution, but I've been researching for days and can't seem to find a simple way to do it.

推荐答案

是的,这是要使用的命令LoadFromText.

Yes, that's the command LoadFromText to use.

用法:

LoadFromText acModule, "NameOfObject", "FileName"

这篇关于以编程方式从* .cls或类似文件将模块导入访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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