带VBA代码的模块化模块 [英] Modufy Modules with VBA Code

查看:343
本文介绍了带VBA代码的模块化模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用VBA读取我的表,然后捕获所有字段名称,例如


表客户端


字段ID              position(0)


字段名称         position(1)


字段地址    位置(2)


等等


我用以下内容写一个TEXT文件


Public Const  ; Client_ID = 0


Public Const  Client_Name = 1


Public Const  Client_Address = 2


    依此类推


然后我复制/过去  TEXT文件到 一个名为 "" TableConstants"


的模块这可以保证我的变量都是定义的,一致的和正确的。


如果我在表格中重新定位一个字段,并重新生成我的表格。 TEXT 文件,我的VBA代码不受影响。


如何删除"TableConstants"?并插入已更改的TEXT 取而代之的是使用VBA代码。








解决方案

您好,


如果您尝试动态修改模块,请查看
DeleteLines
 和
InsertLines
方法。


希望有帮助...


I use VBA to read my tables, then capture all then field names, such as

Table Client

field ID              position (0)

field Name         position (1)

Field Address     Position (2)

and so on

I write a TEXT file with the following

Public Const  Client_ID = 0

Public Const  Client_Name = 1

Public Const  Client_Address = 2

     and so on

I then Copy/Past the  TEXT file to  a module called  "TableConstants"

This insures that my variables are all ways  Defined, consistent and correct.

If I reposition a filed in my tables, and regenerate my  TEXT file, my VBA Codes is not be affected.

How can I delete the "TableConstants" and insert the changed TEXT  in its place, using VBA Code.

解决方案

Hi,

If you're trying to dynamically modify a module, check out the DeleteLines and InsertLines methods.

Hope it helps...


这篇关于带VBA代码的模块化模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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