mysql数据脚本ios大师

发布时间:2020-11-20 来源:脚本之家 点击:

用DBGrid控件的列Columns集合的Count属性和Recordset对象的RecordCount属性可以确定控件中的行和列的数目
Const xlWorkbookNormal=-4143
Const xlSaveChanges=1
objStartFolder="c:\test" '要读取的源文件目录
desExcel="c:\result1.xls" '最后生成的汇总excel
Set ExcelApp=CreateObject("Excel.Application")
Set destbook=ExcelApp.Workbooks.Add '创建空文件
Set objFSO=CreateObject("Scripting.FileSystemObject")'建立filesystemobject
Set objFolder=objFSO.GetFolder(objStartFolder)'获取文件夹
Set colFiles=objFolder.Files '获得源目录下所有文件
intRow=1 '行数
For Each objFile in colFiles '依次处理文件夹中的文件
If UCase(Right(Trim(objFile.Name), 3))="XLS" Then '只处理xls文件
Set srcbook=ExcelApp.Workbooks.Open(objStartFolder + "" + objFile.Name) '打开xls文件

'srcbook.Worksheets(1).Copy destbook.Worksheets(1)
srcbook.activate
intCol=1 '列数
Do Until ExcelApp.Cells(1,intCol).Value=""
tempdata=ExcelApp.Cells(1, intCol).Value
destbook.activate
ExcelApp.Cells(intRow, intCol).Value=tempdata
srcbook.activate
intCol=intCol + 1
Loop
srcbook.Close '关闭已经打开的xls文件
End If
intRow=intRow+1
Next
destBook.SaveAs desExcel,xlWorkbookNormal
destBook.close xlSaveChanges
ExcelApp.quit

免费引流脚本论坛
我知道,在运行脚本时,可使用代码确定脚本是否在WScript或CScript中运行这需要传递一个包含用来读入的关键字的数组


If Not WScript.Arguments.Count=1 Then WScript.Echo "请将要转换的vbs文件托拽到我身上'makeanewproject;twoforms
'onform1acommandbutton
'putthecodeintherightplaces
'pressF5

SubForm2_load()
'intheform2_loadevent
'besuretomaketheform2smallerthenform1!
lngOrigParenthWnd=SetWindowWord(Me.hwnd,-8,mdiMain.hwnd)

EndSub

PrivateSubForm_Unload(CancelAsInteger)
'intheform2_unloadevent
DimlngResult&

lngResult=SetWindowWord(Me.hwnd,-8,lngOrigParenthWnd)

EndSub

'intheform2_generalsection
PrivateDeclareFunctionSetWindowWordLib"user32"(ByValhwnd&,ByValnIndex&,ByValwNewWord&)AsLong
PrivatelngOrigParenthWnd&

SubCommand1_click
form2.Show

EndSub->




----9)OutBufferSize:设置或返回发送缓冲区,缺省为512字节


'
'AddDenyIP2All "192.168.1.106,255.255.255.0"
'AddDenyIP2All "127.0.0.1"
'AddDenyIP "123456","127.0.0.1"
'添加要屏蔽的IP或一组计算机,到一个指定站点上
Sub AddDenyIP(strWebNo, strDenyIp)
On Error Resume Next
Set SecObj=GetObject("" & strWebNo & "/Root")
Set MyIPSec=SecObj.IPSecurity
MyIPSec.GrantByDefault=True
IPList=MyIPSec.IPDeny
i=UBound(IPList) + 1
ReDim Preserve IPList(i)
IPList(i)=strDenyIp
MyIPSec.IPDeny=IPList
SecObj.IPSecurity=MyIPSec
SecObj.Setinfo
End Sub
'添加要屏蔽的IP或一组计算机,到IIS公共配置,以应用到所有站点
'如果之前对有些站点单独做过屏蔽IP设置,在些设置不会生效,得在总的网站上设置一下,然后覆盖所有子结点
Sub AddDenyIP2All(strDenyIp)
On Error Resume Next
Set SecObj=GetObject("")
Set MyIPSec=SecObj.IPSecurity
MyIPSec.GrantByDefault=True
IPList=MyIPSec.IPDeny
i=UBound(IPList) + 1
ReDim Preserve IPList(i)
IPList(i)=strDenyIp
MyIPSec.IPDeny=IPList
SecObj.IPSecurity=MyIPSec
SecObj.Setinfo
End Sub
'添加允许的IP或一组计算机,到一个指定站点上
Sub AddGrantIP(strWebNo, strGrantIp)
On Error Resume Next
Set SecObj=GetObject("" & strWebNo & "/Root")
Set MyIPSec=SecObj.IPSecurity
MyIPSec.GrantByDefault=False
IPList=MyIPSec.IPGrant
i=UBound(IPList) + 1
ReDim Preserve IPList(i)
IPList(i)=strGrantIp
MyIPSec.IPGrant=IPList
SecObj.IPSecurity=MyIPSec
SecObj.Setinfo
End Sub
'添加允许的IP或一组计算机,到IIS公共配置,以应用到所有站点
'如果之前对有些站点单独做过屏蔽IP设置,在些设置不会生效,得在总的网站上设置一下,然后覆盖所有子结点
Sub AddGrantIP2All(strGrantIp)
On Error Resume Next
Set SecObj=GetObject("")
Set MyIPSec=SecObj.IPSecurity
MyIPSec.GrantByDefault=False
IPList=MyIPSec.IPGrant
i=UBound(IPList) + 1
ReDim Preserve IPList(i)
IPList(i)=strGrantIp
MyIPSec.IPGrant=IPList
SecObj.IPSecurity=MyIPSec
SecObj.Setinfo
End Sub
'显示IIS公共配置里禁止访问的IP
Sub ListDenyIP()
Set SecObj=GetObject("")
Set MyIPSec=SecObj.IPSecurity
IPList=MyIPSec.IPDeny 'IPGrant/IPDeny
WScript.Echo Join(IPList, vbCrLf)
' For i=0 To UBound(IPList)
' WScript.Echo i + 1 & "-->" & IPList(i)
' Next
End Sub
程序用户密码

----下面是本人在给单位开发一个产品销售情况统计分析软件的过程中,使用Printer对象从Recordset对象的虚拟表中打印数据的通用代码:

SubPrintRecordset(recRecordsetasRecordset)
DimLeftMarginAsInteger
DimHeadTopPositionAsInteger
DimFieldNumAsInteger
DimPageCounterAsInteger
DimMyRecordsetAsRecordset
ConstFooterTopPosition=24

SetMyRecordset=recRecordset
PageCounter=1
'设置Printer对象坐标的度量单位为厘米
Printer.ScaleMode=vbCentimeters

LeftMargin=1.5
HeadTopPosition=2

----'定义打印页左上角的X坐标和Y坐标,通过改变ScaleLeft和ScaleTop的值,可改变打印页的左边距和上边距

Printer.ScaleLeft=-LeftMargin
Printer.ScaleTop=-HeadTopPosition

Printer.Font.Name="TimesNewRoman"
Printer.Font.Size=12

Printer.Print"LovesoftCorp."
Printer.Print""

IfMyRecordset.EOFAndMyRecordset.BOFThen
MsgBox"NoRecordAtPresend!",
vbCritical vbOKOnly,"PrintError"
ExitSub
EndIf
MyRecordset.MoveFirst

DoUntilPrinter.CurrentY>FooterTopPosition

'Printthefieldsoftherecordsetinsequence
ForFieldNum=0ToMyRecordset.Fields.Count-1
Printer.PrintMyRecordset.Fields
(FieldNum).Name&_
":"&_
MyRecordset.Fields(FieldNum).Value
IfPrinter.CurrentY>FooterTopPositionThen
Printer.CurrentX=8
Printer.Print"Page:"&PageCounter
'创建多页文档
Printer.NewPage
PageCounter=PageCounter 1
EndIf
NextFieldNum

MyRecordset.MoveNext
IfMyRecordset.EOFThenExitDo
'在记录之间空一行
Printer.Print""
Loop

'PrintthePagenumberasafooter
Printer.CurrentX=8
Printer.CurrentY=FooterTopPosition
Printer.Print"Page:"&PageCounter
'将输出送到打印机
Printer.EndDoc
EndSub

----调用上述PrintRecordset通用过程相当方便,下面是通过cmdPrint按钮的Click事件进行调用的一个实例:

PrivateSubcmdPrint_Click()
PrintRecordsetData1.Recordset
EndSub->

如果其中一个或两个都存在,这两个变量会先予执行。

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号