- ©«¤l
- 40
- ¥DÃD
- 17
- ºëµØ
- 0
- ¿n¤À
- 62
- ÂI¦W
- 0
- §@·~¨t²Î
- windows XP
- ³nÅ骩¥»
- office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-12-27
- ³Ì«áµn¿ý
- 2014-11-18
|
EXCEL Äæ¦ì¿ï¾Ü¤Î¶K¤W°ÝÃD
¤p§Ì¤S¨Óµo°Ý¤F>"<
·Q½Ð°Ý¦U¦ì°ª¤âÌ
³o¬O¤p§Ì¼gªº¤pµ{¦¡
Private Sub OpenByAdo_Click()
Dim strPath As String
strPath = Me.PathTextBox.Text
Dim strFileName As String
strFileName = Me.FileNameTextBox.Text
Dim strSheetName As String
strSheetName = "²M³æ"
OpenExcelByAdo2 strPath, strFileName, strSheet
End Sub
Public Sub OpenExcelByAdo2( path, file, sheet )
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.Oledb.4.0;" & _
"Extended Properties=""Excel 8.0; HDR=NO"";" & _
"Data Source=" & path & "\" & file
'----------------------------------------------------------------------------------------------------------
Dim strSQL As String
strSQL = "select * from [" & sheet & "$] where F18 like '%A%' " '¿ï¨úÄæ¦ì F18¬°RÄæ¦ì ·í¤¤§t¦³"A"¦r
If cn.State = adStateOpen Then
Set rs = cn.Execute(strSQL)
Do Until rs.EOF
Debug.Print rs.Fields.Item("F1") 'Åã¥ÜF1Äæ¦ì
rs.MoveNext
Loop
MsgBox "Success"
cn.Close
End If
Set conn = Nothing
Set rs = Nothing
End Sub
¤p§Ì¦bVB¯à°÷Åã¥Ü¥X¦¹sheet ªºF18(¤ÎRÄæ¦ì) ·í¤¤§t¦³"A"¦rªºÄæ¦ì ( ¦ý·|À³Àɮפ£¦P¦Ó§ïÅÜ ©Ò¥H§t¦³"A"¦rªºÄæ¦ì¬OÀH¾÷ªº)
¤p§Ì·Q½Ð°Ý¦p¦ó¯à°÷§â³o¨ÇÄæ¦ì¼Æ¦C¦ì¼Æ¤Î¤º®e¼È¦s°_¨Ó(¥H¤Î¨ä¥LÄæ¦ìªº¤º®e) ©Î¬O¥i§â¦UÄæ¦ì¦C¦ìªº¤º®e«ö·Ó¶¶§Ç¶K¦Ü¥t¤@SHEET©O?
EX :
A B C R
1 KK ¤p¦W A
2 CC ¤pµØ B
3 DD ¤p·s C
4 UU ¤p¬ü A
5 YY ¤p´¹ A
6 TT ¤p©ö A
¸g¹LSECLET«á
A B C R
1 KK ¤p¦W A
4 UU ¤p¬ü A
5 YY ¤p´¹ A
6 TT ¤p©ö A
¶K¦Ü¥t¤@SHEET( ¥i¥Hªº¸Ü §â¸ê®Æ¼È¦s°_¨Ó)
A B C D
1 KK ¤p¦W A
2 UU ¤p¬ü A
3 YY ¤p´¹ A
4 TT ¤p©ö A
½Ð±Ð¦U¦ì¤j¤j̤F>"< |
|