ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

©óvb¤¤¦p¦ó¨Ï.xls¼W¤@µ§¸ê®Æ¦sÀÉ

©óvb¤¤¦p¦ó¨Ï.xls¼W¤@µ§¸ê®Æ¦sÀÉ

´N±Ð©ó¦U¦ì¤j¤j:
­Ó¤H´¿¨üKeeKing«ü¾É¤§¤U¡A¼g¤Fform¤§VB
¥i¥H¬d¸ß«oµLªk¼W¤@µ§¸ê®Æ¡AÀ³¦p¦ó³B²z¡H
Dim Book As Object
Dim Book1 As Object
Dim n
Private Sub Command1_Click()
    Unload Me
End Sub
Private Sub Form_Initialize()
    Dim fso, F As Object, Box, Tile$
    Tile = "Àɮ׸ô®|¦WºÙ"
    On Error GoTo ER
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set F = fso.GetFile("µn¿ý.xls")
        n = fso.GetParentFolderName(F.Path)
    Set Book = CreateObject(n & "\µn¿ý.xls")
    Set Book1 = Book.sheets("¾Ç¥Í¸ê®Æ")
    For I = 1 To 6
        Me.Controls("Label" & I).Caption = Book1.cells(1, I)
    Next
    Text1 = ""
    Exit Sub
ER:
    Set fs = CreateObject("Scripting.FileSystemObject")
    Box = InputBox(Tile, Tile)
    If Box = "" Then End
    If fs.FileExists(Box) Then
        Set Book = CreateObject(Box)
    Else
        GoTo ER
    End If
    Err.Clear
    Resume Next
End Sub

Private Sub Text1_Change()
    Dim Rng As Object, E, I%, C&
     C = Book1.range("a1").End(4).Row
    For Each E In Book1.range("a2:a" & C)
        If E = Text1 Then Set Rng = E: Exit For
    Next
    If Not Rng Is Nothing Then
        Book1.cells(C + 1, 1) = Text1
        For I = 1 To 5
            Me.Controls("Label" & I + 6).Caption = Rng.cells(1, I + 1)
            Book1.cells(C + 1, I + 1) = Rng.cells(1, I + 1)    '¹Á¸Õ¼W¥[¤@µ§¸ê®Æ¡A°£«D¦Û¦æ¥t¥~¶}.xls¤~·|¼g¤J
        Next
    Else
        For I = 1 To 5
            Me.Controls("Label" & I + 6).Caption = ""
        Next
    End If
   
End Sub

«D±`·PÁÂGBKee¡C

TOP

¦^´_ 6# yangjie
¥i§_¦bVB¤U¹ï.xls¤U«ü¥O¨Ïvisible=true
VB §Ú¤£¤Ó¼ô  VBA¬OVBªº©µ¦ù À³¸Ó«Ü¬Ûªñ ¦p¤U§Ú¸Õ¤F¥i¥H¥Îªº
Set Book = CreateObject(n "\µn¿ý.xls")
    With Book.Parent
        .Visible = True
        .windows("µn¿ý.xls").Visible = True
    End With
ºô­¶³sµ²VB»sµ{ªº.exe ¥Ñ.exe¥h«ü©w"Excel Application"¶}.xls(§tVBA)¡A¦¹®É²×ºÝ¾÷¥i°õ¦æ§_?
§Ú¥\¤O¤£°÷ ©|»Ý°ª¤â¨Ó¸Ñµª

TOP

·PÁÂGBKee¡C
¥iSave¤F¡A¥u¬O¹ïExcelÅܦ¨µøµ¡ÁôÂáA¥i§_¦bVB¤U¹ï.xls¤U«ü¥O¨Ïvisible=true-----°ÝÃD¤@¡C
¨Ã½Ð±Ðª©¥D:ºô­¶³sµ²VB»sµ{ªº.exe ¥Ñ.exe¥h«ü©w"Excel Application"¶}.xls(§tVBA)¡A¦¹®É²×ºÝ¾÷¥i°õ¦æ§_?
(©óPC¤U¥i°õ¦æ¨S°ÝÃD)(³o½g¤£ª¾¦p¦óªþ¤Wªþ¥ó¡A¥i¯à¬O¤p¾Ç¥ÍªºÃö«Y)

TOP

¦^´_ 1# yangjie
­n°µ¦sÀÉ
  1. Private Sub Command1_Click()
  2.     Book1.Parent.Save
  3.     Unload Me
  4. End Sub
½Æ»s¥N½X

TOP

¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

ÁÂÁÂHsiehª©¥D
¥HEXCELÀɬ°¸ê®Æ®w°µ¸ê®Æ®w¬d¸ß¡A¼g¤J
¤S¦p¦ó¤U»yªk¡A¥i§_½ç±Ð¡I
Set Book = CreateObject(n "\µn¿ý.xls")
»Pconnection ¬O¥G²£¥Í­«½Æ¶}ÀÉ¿ù»~
À³¦p¦ó¤U¤â¡AÀµ½Ð½ç±Ð

TOP

¦^´_ 1# yangjie
VB¾Þ§@EXCEL
«Øij¥HEXCELÀɬ°¸ê®Æ®w
°µ¸ê®Æ®w¬d¸ß¡A¼g¤J
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¤f»¡¤@¥y¦n¸Ü¡A¦p¤f¥X½¬ªá¡F¤f»¡¤@¥yÃa¸Ü¦p¤f¦R¬r³D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD