零基础学脚本开发公司宣传片流程

发布时间:2021-12-09 来源:脚本之家 点击:




  (3)声明中的ByVal是作什么用的

  这跟VB的参数传递方式有关,在默认情况下VB是通过地址传递方式传递函数的参数、而有些API函数要求必须采用传值方式来传递函数参数(这两种参数传递方式是不同的,前者传递的是一个指针,而后者要求是参数真实的值)我们敢打赌,对于能完成这件事,您会感到很高兴,不是吗?或者,至少如果我们的确做到了这一点,您就会高兴

shell脚本for循环实例

  if instr(overip,newip)=0 then '去除重复的IP代码如下:

->If(x<>0)AndyThen...->
->

Metabase Path=MSFTPSCV/945765436
->

其实实现方法并不复杂,现将心得写出来,希望对大家有帮助


Function ReadExcel( myXlsFile, mySheet, my1stCell, myLastCell, blnHeader )
' Function : ReadExcel
' Version : 2.00
' This function reads data from an Excel sheet without using MS-Office
'
' Arguments:
' myXlsFile [string] The path and file name of the Excel file
' mySheet [string] The name of the worksheet used (e.g. "Sheet1")
' my1stCell [string] The index of the first cell to be read (e.g. "A1")
' myLastCell [string] The index of the last cell to be read (e.g. "D100")
' blnHeader [boolean] True if the first row in the sheet is a header
'
' Returns:
' The values read from the Excel sheet are returned in a two-dimensional
' array; the first dimension holds the columns, the second dimension holds
' the rows read from the Excel sheet.
'
' Written by Rob van der Woude
'
Dim arrData( ), i, j
Dim objExcel, objRS
Dim strHeader, strRange

Const adOpenForwardOnly=0
Const adOpenKeyset=1
Const adOpenDynamic=2
Const adOpenStatic=3

' Define header parameter string for Excel object
If blnHeader Then
strHeader="HDR=YES;"
Else
strHeader="HDR=NO;"
End If

' Open the object for the Excel file
Set objExcel=CreateObject( "ADODB.Connection" )
' IMEX=1 includes cell content of any format; tip by Thomas Willig
objExcel.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
myXlsFile & ";Extended Properties=""Excel 8.0;IMEX=1;" & _
strHeader & """"

' Open a recordset object for the sheet and range
Set objRS=CreateObject( "ADODB.Recordset" )
strRange=mySheet & "$" & my1stCell & ":" & myLastCell
objRS.Open "Select * from [" & strRange & "]", objExcel, adOpenStatic

' Read the data from the Excel sheet
i=0
Do Until objRS.EOF
' Stop reading when an empty row is encountered in the Excel sheet
If IsNull( objRS.Fields(0).Value ) Or Trim( objRS.Fields(0).Value )="" Then Exit Do
' Add a new row to the output array
ReDim Preserve arrData( objRS.Fields.Count - 1, i )
' Copy the Excel sheet's row values to the array "row"
' IsNull test credits: Adriaan Westra
For j=0 To objRS.Fields.Count - 1
If IsNull( objRS.Fields(j).Value ) Then
arrData( j, i )=""
Else
arrData( j, i )=Trim( objRS.Fields(j).Value )
End If
Next
' Move to the next row
objRS.MoveNext
' Increment the array "row" number
i=i + 1
Loop

' Close the file and release the objects
objRS.Close
objExcel.Close
Set objRS=Nothing
Set objExcel=Nothing

' Return the results
ReadExcel=arrData
End Function
优秀教师宣传令人欣喜的是,VB提供了一个可用来调用其他应用程序的Shell函数,使VB的某些功能可直接由其他应用程序来完成,从而大大地减少了编程任务VBS居然可以调用那么多对象。

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