Access VBA:有什么方法可以获取计算机规格? [英] Access VBA: Is there any way to get computer specs?

查看:116
本文介绍了Access VBA:有什么方法可以获取计算机规格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Access中创建一个表单,该表单处理数百万行数据,并需要几个小时(取决于您的计算机). 我想实现一项功能,该功能可以读取计算机规格,例如CPU速度和RAM数量,并确定该过程将花费多长时间.

I'm creating a form in Access that processes millions of lines of data, and takes several hours (depending on your computer). I want to implement a feature that will read the computer specs, such as CPU speed and amount of RAM, and determine how long the process will take.

是否可以使用VBA获得计算机规格?

Is it possible to get the computer specs using VBA?

推荐答案

1)有此环境"功能可以为您提供有关计算机"环境的信息.通常用于获取用户名或临时文件夹之类的东西,但据说它会返回以下值:

1) There is this "environ" function that can give you informations on the "computer" environment. It is usually used to get things such as user name or temp folder, but it is said to return the following values:

environ(x): value returned
1 : ALLUSERSPROFILE
2 : APPDATA
3 : CLIENTNAME
4 : CommonProgramFiles
5 : COMPUTERNAME
6 : ComSpec
7 : HOMEDRIVE
8 : HOMEPATH
9 : LOGONSERVER
10 : NUMBER_OF_PROCESSORS
11 : OS
12 : Path
13 : PATHEXT
14 : PROCESSOR_ARCHITECTURE
15 : PROCESSOR_IDENTIFIER
16 : PROCESSOR_LEVEL
17 : PROCESSOR_REVISION
18 : ProgramFiles
19 : SESSIONNAME
20 : SystemDrive
21 : SystemRoot
22 : TEMP
23 : TMP
24 : USERDOMAIN
25 : USERNAME
26 : USERPROFILE
27 : windir 

2)您有一些shell函数,可用于启动外部程序并获取值.除了标准的VBA Shell功能外,您还可以使用一些有趣的东西,例如" shell并等待"功能.

2) you have some shell functions that can be used to launch external programs and get a value back. In addition to the standard VBA shell function, you also have some interesting things such as this "shell and wait" function.

3)当然,您始终可以在VBA代码中从Windows API声明函数,并使用它们来获取所需的值...

3) Of course, you can always declare functions from the windows API in your VBA code and use them to get needed values ...

这篇关于Access VBA:有什么方法可以获取计算机规格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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