ÈçºÎÓÃVBʵÏÖExcelÎļþµÄ×Ô¶¯ºÏ²¢
¼òµ¥¶øʵÓõĺϲ¢ExcelÎļþµÄº¯Êý£¬Äܹ»½«¶à¸öXLSÎļþÖÐÖ¸¶¨ÊýÁ¿µÄ¹¤×÷±í×Ô¶¯ºÏ²¢µ½Ò»¸öXLSÎļþÀï¡£µ±È»£¬Èç¹ûÖ»ÊÇÊý¾ÝºÏ²¢£¬ÔòʹÓÃADO¾Í¿ÉÒÔʵÏÖ£¬µ«Èç¹ûÒª±£Áô±í¸ñ¸ñʽ£¬Ôò¿ÖÅÂÖ»ÄÜʹÓð³µÄ·½·¨ÁË¡£
Ò»¡¢º¯Êý´úÂ룺
Option Explicit
'* ************************************************************** *
'* º¯ÊýÃû³Æ£ºMergeXlsFile
'* ¹¦ÄÜ£º×Ô¶¯ºÏ²¢Ö¸¶¨Â·¾¶ÏµÄËùÓÐXLSÎļþµ½Ò»¸öÎļþÖÐ
'* ²ÎÊý˵Ã÷£ºstrPath£ºÐèÒªºÏ²¢µÄXLSÎļþËùÔÚ·¾¶¡£
'* SheetCount£ºÐèÒªºÏ²¢µÄµ¥¸ö¹¤×÷²¾Öй¤×÷±íÊýÁ¿
'* ×÷Õߣºlyserver
'* ÁªÏµ·½Ê½£ºhttp://blog.csdn.net/lyserver
'* ************************************************************** *
Public Function MergeXlsFile(ByVal strPath As String, Optional ByVal SheetCount As Byte = 1) As Boolean
Dim i As Integer
Dim strSrcFile As String
Dim nRows As Long, nCols As Long, nSheets As Byte, nNewRows() As Integer
Dim xlApp As Object, xlSrcBook As Object, xlNewBook As Object, xlSheet As Object, xlRange As Object
On Error Resume Next
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
'Èç¹ûÐèÒªºÏ²¢ÎļþÖеŤ×÷±íÊýÁ¿Ð¡ÓÚ1ÔòÍ˳ö
If SheetCount < 1 Then Exit Function
'ɾ³ýµô¸Ã·¾¶ÏÂÔÀ´µÄºÏ²¢Îļþ
If Dir(strPath & "ºÏ²¢ºóµÄÎļþ.xls") <> "" Then Kill strPath & "ºÏ²¢ºóµÄÎļþ.xls"
'»ñµÃµÚ1¸öXLSÎļþ
strSrcFile = Dir(strPath & "*.xls")
'Èç¹ûÎļþ²»´æÔÚÔòÍ˳ö
If Len(strSrcFile) = 0 Then Exit Function
'´´½¨Ò»¸öExcelʵÀý
Set xlApp = CreateObject("Excel.Application")
'н¨Ò»¸ö¹¤×÷²¾
Set xlNewBook = xlApp.Workbooks.Add
'µ÷Õûн¨¹¤×÷²¾À﹤×÷±íµÄÊýÁ¿
ReDim nNewRows(1 To SheetCount)
For i = 1 To SheetCount - xlNewBook.Sheets.Count
xlNewBook.Sheets.Add , xlNewBook.Sheets(xlNewBook.Sheets.Count)
Next
'Ñ»·²éÕÒµ±Ç°Â·¾¶ÏµÄËùÓÐXLSÎļþ
Do
'´ò¿ªÕÒµ½µÄXLSÎļþ
Set xlSrcBook = xlApp.Workbooks.Open(strPath & strSrcFile)
'Ñ»·¸´ÖÆÔ´XLSÎļþÀïµÄ¹¤×÷±í
Ïà¹ØÎĵµ£º
ÔÚ¿ª·¢IP-MACɨÃè¼àÊÓÆ÷ʱ£¬ÉèÖÃÁË¿ª»ú×Ô¶¯ÔËÐУ¬µ«Êǵ±WINDOWSÆô¶¯ºó£¬³ÌÐòÔËÐкóÈ´´ò¿ª´°ÌåÁË£¬²»ÊÇ×îС»¯ÔËÐеġ£ÕâÔõô°ìÄØ£¿ÓÚÊÇÏëµ½¼ÓÒ»¸ö²ÎÊý¸ø³ÌÐòÆô¶¯Ê±£¬µ«²»ÖªµÀÔõôʵÏÖ£¬½á¹û·¢ÏÖVBÖÐÓÐcommand£¬ÊÇ¿ÉÒÔ½ÓÊܲÎÊýµÄ¡£Ö±½Ó£ºAAA.EXE xxx,
ÔÚ³ÌÐòÖÐÓÃÒ»¸ö±äÁ¿µÃµ½Õâ¸ö²ÎÊý£¬ÄǾͿÉÒÔÁË¡£×ö·¨£º
1¡¢ÔÚ×¢²á±í×ÔÆô¶ ......
Option Explicit
Function Delete3(Arr As Variant) As Variant
Dim i As Integer
For i = LBound(Arr) To UBound(Arr)
If i > UBound(Arr) Then Exit For
If Arr(i) = 3 Then
Do
Dim j As Integer
For j = i To UBound(Arr) - 1
......
VB¶ÔINIÎļþ²Ù×÷
2009-02-25 00:17
INI ÎļþÊÇʲôÑù×Ó£¿——²»»á°É£¬Õⶼ²»ÖªµÀ¡£INI Îļþ¾ÍÊÇ Windows Öг£¼û
µÄÒÔ .ini ΪÀ©Õ¹ÃûµÄÎļþ£¬ÆäÄÚ²¿¸ñʽºÍ¸÷²¿·ÖµÄÃû³ÆÈçÏ£º
[Section1]
Key1=Value1
Key2=Value2
Key3=Vlaue3
[Section2]
Key1=Value1
Key2=Value5
Key4=Value4
Key5=...
...
& ......
'* ************************************************************** *
'* ³ÌÐòÃû³Æ£ºButton.ctl
'* ³ÌÐò¹¦ÄÜ£ºÍ¸Ã÷¸¡¶¯°´Å¤
'* ×÷Õߣºlyserver£¬×îºóÐÞ¸ÄÈÕÆÚ£º2009Äê11ÔÂ
'* ÁªÏµ·½Ê½£ºhttp://blog.csdn.net/lyserver
'* ************************************************************ ......
³¤¾ÃÒÔÀ´£¬ÓÉÓÚ²»ÄÜÖ±½Ó»ñµÃVBÀà³ÉÔ±º¯ÊýÖ¸Õ룬ÒòΪÎÞ·¨ÔÚVBµÄÀàÄ£¿éÖÐÖ±½ÓʹÓö¨Ê±Æ÷¿Ø¼þ»ò¶¨Ê±Æ÷API£¬»ùÓÚ°³±àдµÄ»ñµÃÀà³ÉÔ±º¯ÊýÖ¸ÕëµÄº¯Êý£¬°³±àдÁËÕâ¸ö´ø¶¨Ê±Æ÷¹¦ÄܵÄÀ࣬ϣÍû¸øÅóÓÑÃÇһЩÆô·¢¡£
Ò»¡¢Ð½¨Ò»¸öÀ࣬ÀàÃû³ÆΪclsTimer£¬Àà´úÂëÈçÏ£º
Option Explicit
'* ** ......