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

½Ð°Ý¦p¦ó¦ÛÀɮ׸ô®|ªº¦r¦ê¤¤¡A©î¥X¸ô®|©MÀɦW?

½Ð°Ý¦p¦ó¦ÛÀɮ׸ô®|ªº¦r¦ê¤¤¡A©î¥X¸ô®|©MÀɦW?

½Ð°Ý¦U¦ì¥ý¶i~
Windows("filename.xls").Activate¬O¤£¬O¤£¯à¤Þ¥Î¸ô®|?¨Ò¦pWindows("F:\§Úªº¤å¥ó\9908\filename.xls").Activate
¦pªG³o¼Ëªº¸Ü¡A§Ú·Q§â¸ô®|©MÀɦW¤À§O©î¥X(¸ô®|©MÀɦW³£¤£¬O©T©wªø«×)¡A¦A ChDir¦n¤F~
strDir = "F:\§Úªº¤å¥ó\9908\"
strFile = "filename.xls"
½Ð°Ý«ç»ò³B²zªü??
ÁÂÁÂ

¦^´_ 1# examsuper

Windows("F:\§Úªº¤å¥ó\9908\filename.xls").Activate ³o»yªk¦ü¥G¨S¥²­n..?
¦]¬°¦P¤@®É¶¡,¤£·|¶}¨â­Ó¦P¼ËÀɦWªº excel ÀÉ®×..

TOP

±z»~·|§Ú·N«ä¤F~¬O¥t¤@­ÓÀÉ
¥u¬O§Ú§â"§¹¾ã¸ô®|\ÀɦW"·í§@°Ñ¼Æ¡AWindows().Activate´N¤£WORK¤F~

TOP

±q¦r¦ê¨úÀɦWªº¤è¦¡,¥i°Ñ¦Ò.
http://gb.twbts.com/index.php?topic=4068.0

¦pªG¥Î°j°é³B²z..
a = "F:\§Úªº¤å¥ó\9908\filename.xls"
For i = Len(a) To 1 Step -1
    If Mid(a, i, 1) = "\" Then
        file_name = Right(a, Len(a) - i)
        file_path = Left(a, i - 1)
        Exit For
    End If
Next i

TOP

¦^´_ 1# examsuper
    Windows("F:\§Úªº¤å¥ó\9908\filename.xls").Activate   §ï¦¨¦p¤U
    Workbooks.Open("F:\§Úªº¤å¥ó\9908\filename.xls").Activate
  1. Sub Ex()
  2.     Dim file$, Ar
  3.    file = "F:\§Úªº¤å¥ó\9908\filename.xls"
  4.     Ar = Split(file, "\")
  5.     strDir = Replace(file, Ar(UBound(Ar)), "")
  6.     strFile = Ar(UBound(Ar))
  7.     ChDir strDir
  8.     Workbooks.Open (strFile)
  9. End Sub
½Æ»s¥N½X

TOP

  1. Sub nn()
  2. Dim fds As Object
  3. Set fds = CreateObject("Scripting.FileSystemObject")
  4. Set fs = fds.getfile("F:\§Úªº¤å¥ó\9908\filename.xls")
  5. msgbox "¸ô®| =" & fds.GetParentFolderName(fs)
  6. msgbox "ÀɦW =" & fs.Name
  7. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2010-9-3 00:37 ½s¿è

¥u­n§ä¨ì³Ì«á¤@­Ó "\" ªº¦ì¸m,
¦A¨Ì¦¹±N§¹¾ãªºÀɦW¦r¦ê¤À§O©î¶}¨ú¥Î§Y¥i.

Dim sStr$, i%, strDir$, strFile$
sStr = "F:\§Úªº¤å¥ó\9908\filename.xls"
i = InStrRev(sStr, "\", Len(sStr), 1)
strDir = Left(sStr, i)
strFile = Mid(sStr, i + 1, Len(sStr) - i)

TOP

¤Ó·PÁ¦U¦ì¥ý¶iªº¼ö¤ß¤F¡A
¤p§Ì¯u¬O¨ü±Ð¤F~ÁÂÁ¨C¤@¦ì~

TOP

        ÀR«ä¦Û¦b : ¬Ý§O¤H¤£¶¶²´¡A¬O¦Û¤v­×¾i¤£°÷¡C
ªð¦^¦Cªí ¤W¤@¥DÃD