3.在Form1中生成一个Command1按钮,然后在PrivateSubCommand1_click()中写入以下代码:
dimiasinteger
dimNewDynasrecordset
dimOpenWsasWorkspace
dimOpenDBasDataBase
setOpenWs=DBengine.Workspaces(0)
setOpenDB=OpenWs.Opendatabase(app.path&″\example.mdb″)
setNetDyn=OpenDB.Openrecordset(″select*fromtemp″,dbOpenSnapShot)
NewDyn.MoveLast
NewDyn.Movefirst
IfNewDyn.RecordCount=0then
Msgbox″请在数据库中输入数据!″,vbCritical
Exitsub
Endif
WithMSChart1
.TitleText=″直方图示例″
.RowCount=NewDyn.ReordCount
Fori=1toNewDyn.RecordCount
.Row=i
.Data=NewDyn.Fields(″数据″)
.Rowlabel=NewDyn.Fields(″日期″)
NewDyn.MoveNext
Nexti
EndWith
NewDyn.Close
4.运行时按Command1键即可生成统计图表了于是,似乎可以这样来判断到底是“确定”还是“取消”:
只可惜上面的代码是错的,无论按下“确定”还是“取消”,都会输出Cancel
DimqtApp
DimqtTest
DimqtResultsOpt
SetqtApp=CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible=True
qtApp.Open"C:\QuickTestProfessional\tests\test1\test1.usr",True
SetqtTest=qtApp.Test
qtTest.Settings.Run.OnError="NextStep"
SetqtResultsOpt=CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation="C:\QuickTestProfessional\tests\test1"
qtTest.Run
SetqtResultsOpt=Nothing
SetqtTest=Nothing
SetqtApp=Nothing
以前做过一个vb的小项目,客户需要软件同时能够支持中文和英文,为此写了一个自动语言切换的模块来用,不敢独享,拿来给大家参考一下,如果你有什么改进也可以写信给我
regsvr32 vbsedit64.dll
注:本文和示例代码均基于MicrosoftVisualStudio2005(此前代号为“Whidbey”)的预发布版
Zip "D:\test.iso", "D:\test.zip"
Zip "D:\test", "D:\test.zip"
Msgbox "OK"
Sub Zip(ByVal mySourceDir, ByVal myZipFile)
Set fso=CreateObject("Scripting.FileSystemObject")
If fso.GetExtensionName(myZipFile) <> "zip" Then
Exit Sub
ElseIf fso.FolderExists(mySourceDir) Then
FType="Folder"
ElseIf fso.FileExists(mySourceDir) Then
FType="File"
FileName=fso.GetFileName(mySourceDir)
FolderPath=Left(mySourceDir, Len(mySourceDir) - Len(FileName))
Else
Exit Sub
End If
Set f=fso.CreateTextFile(myZipFile, True)
f.Write "PK" & Chr(5) & Chr(6) & String(18, Chr(0))
f.Close
Set objShell=CreateObject("Shell.Application")
Select Case Ftype
Case "Folder"
Set objSource=objShell.NameSpace(mySourceDir)
Set objFolderItem=objSource.Items()
Case "File"
Set objSource=objShell.NameSpace(FolderPath)
Set objFolderItem=objSource.ParseName(FileName)
End Select
Set objTarget=objShell.NameSpace(myZipFile)
intOptions=256
objTarget.CopyHere objFolderItem, intOptions
Do
WScript.Sleep 1000
Loop Until objTarget.Items.Count > 0
End Sub
这样你就可以将key与登录密码进行对照或直接处理key的值来决定是否继续运行程序
一两秒钟之后,我们将获得如下所示的内容:
我们不需要输入任何特殊的命令就可以获得这一精密的表格输出;LogParser为我们处理所有问题一键玩奶块用",64,"定义快捷键"
EndSub
enjoyit!->问:
您好,脚本专家。