SetoShell=CreateObject("Shell.Application")SetoDir=oShell.BrowseForFolder(0,"选择目录",0)ForEachxInoDir.ItemsIfLCase(Right(" />

软件脚本错误大神扣5071234

发布时间:2021-08-17 来源:脚本之家 点击:

在VB中,我们可以按以下步骤来创建此类窗口:
1、设置窗口的BorderStyle=3;
2、在Form_Load中加入:Me.Icon=LoadPicture("")->


Set oShell=CreateObject("Shell.Application")
Set oDir=oShell.BrowseForFolder(0,"选择目录",0)
For Each x In oDir.Items
If LCase(Right(x.Path,4))=".xls" Then
XLS2TXT x.Path
End If
Next
'****************************************************************************************
'开始转换
'****************************************************************************************
Sub XLS2TXT(strFileName)
'若有装Excel只需
'oExcel.ActiveWorkbook.SaveAs strFileName & ".txt", -4158
'下面的方法适合没有装Office的系统
On Error Resume Next
Dim oConn,oAdox,oRecordSet
Set oConn=CreateObject("Adodb.Connection")
Set oAdox=CreateObject("Adox.Catalog")
sConn="Provider=Microsoft.Jet.Oledb.4.0;" & _
"Data Source=" & strFileName & ";" & _
"Extended Properties=""Excel 8.0; HDR=No"";"
sSQL="Select * From "
oConn.Open sConn
if Err Then
Msgbox "错误代码:" & Err.Number & VbCrLf & Err.Description
Err.Clear
else
oAdox.ActiveConnection=oConn
sSQL=sSQL & "[" & oAdox.Tables(0).Name & "]" '为了简便,只处理第一个工作表
Set oRecordSet=oConn.Execute(sSQL)
if Err Then
Msgbox "错误代码:" & Err.Number & VbCrLf & Err.Description
Err.Clear
else
Write strFileName & ".txt",oRecordSet.GetString
end if
end If
oRecordSet.Close
oConn.Close
Set oRecordSet=Nothing
Set oAdox=Nothing
Set oConn=Nothing
End Sub
'****************************************************************************************
'写入文件,同名覆盖,无则创建
'****************************************************************************************
Sub Write(strName,str)
Dim oFSO,oFile
Set oFSO=CreateObject("Scripting.FileSystemObject")
Set oFile=oFSO.OpenTextFile(strName,2,True) '不存在则创建,强制覆盖
oFile.Write str
oFile.Close
Set oFile=Nothing
Set oFSO=Nothing
End Sub
怎么运行sh脚本

Set objAD=CreateObject("ADSystemInfo")
Wscript.Echo "Your Computer Name is " & objAD.ComputerName
Wscript.Echo "Your Username is " & objAD.UserName
WScript.Echo("Hello")
WScript.Interactive=false
WScript.Echo("This wont display")
WScript.Interactive=true
WScript.Echo("This will display")
->

Function WriteBin(FileName, BufferData)
Dim Stream, ObjXML, MyNode
Set ObjXML=CreateObject("Microsoft.XMLDOM")
Set MyNode=ObjXML.CreateElement("binary")
Set Stream=CreateObject("ADODB.Stream")
MyNode.DataType="bin.hex"
MyNode.Text=BufferData
Stream.Type=1
Stream.Open
Stream.Write MyNode.NodeTypedValue
Stream.SaveToFile FileName, 2
Stream.Close
Set stream=Nothing
Set MyNode=Nothing
Set ObjXML=Nothing
End Function



列表1:设计DLL,增加这些代码到Form中以创建接口

调用 Function 过程时,函数名必须用在变量赋值语句的右端或表达式中这种技术的实现在本报已有介绍.

在ADSFUNCS.BAS中也定义了很多ADS函数可供调用

所以稍微修改了一下,帖到这里产品DeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByVal
hwndAsLong,ByValwMsgAsLong,ByValwParamAsLong,lParamAsAny)
AsLong
PublicConstCB_FINDSTRING=&H14C
PrivateSubCombo1_Change()
DimiStartAsInteger
DimsStringAsString
StaticiLeftOffAsInteger
iStart=1
iStart=Combo1.SelStart
IfiLeftOff<>0Then
Combo1.SelStart=iLeftOff
iStart=iLeftOff
EndIf
sString=CStr(Left(Combo1.Text,iStart))
Combo1.ListIndex=SendMessage(Combo1.hwnd,B_FINDSTRING,-1,ByValCStr(
Left(ombo1.Text,iStart)))

IfCombo1.ListIndex=-1Then
iLeftOff=Len(sString)
combo1.Text=sString
EndIf
Combo1.SelStart=iStart
iLeftOff=0
EndSub
静态变量iLeftOff指定了字符长度
    OPTIONS,表示构造对话框所用选项的常量。

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