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

Workbooks.Open ªº¥Îªk

Workbooks.Open ªº¥Îªk

Application.Workbooks.Open ("D:\B.xls")
Workbooks.Open "D:\B.xls"
½Ð±Ð¡G
¢°¡D¥H¤W¨âºØ¶}±ÒÀɮתº®t²§¤Î¨Ï¥Î®É¾÷?
¢±¡D¬°¦ó¤@©w­n«ü©w¸ô®|D:\¡A¦pªG©Ò¦³EXCELÀɮ׳£©ñ¦b¬Û¦Pªº¸ô®|(¥Ø¿ý¡^¤U¡A¥i¤£¥i¥H¦³¤°»ò²«Kªº¼gªk?
Thanks!

·PÁ«ü±Ð,¨ü´f¨}¦h.§ÚÁÙ­nªá®É¶¡®ø¤Æ§l¦¬¤F¸Ñ­Ó¤¤¥©§®.

TOP

¦^´_ 1# openpc
  1. Option Explicit
  2. Sub Ex()
  3. Dim S As Workbook, xlPath As String
  4. xlPath = CurDir                      'CurDir ¨ç¼Æ ¶Ç¦^¤@­Ó Variant (String)¡A¥Î¨Ó¥Nªí¥Ø«eªº¸ô®|¡C
  5. Application.Workbooks.Open "a.xls"   '¶}±Ò¥Ø«eªº¸ô®|ªºÀÉ®×
  6. 'Workbooks.Open xlPath & "a.xls"     '¶}±Ò«ü©w¸ô®|ªºÀÉ®×
  7. 'Set S = Workbooks.Open("a.xls")     '«ü©w¨ìÅܼƭn( )
  8. MsgBox ActiveWorkbook.FullName
  9. End Sub
  10. '¦pªG©Ò¦³EXCELÀɮ׳£©ñ¦b¬Û¦Pªº¸ô®|(¥Ø¿ý¡^¤U¡A¥i¤£¥i¥H¦³¤°»ò²«Kªº¼gªk?
  11. Sub Ex1()
  12.     Dim xlPath As String
  13.     xlPath = "D:\test\"
  14.     ChDrive Mid(xlPath, 1, 1)    '²¾°Ê(ºÏºÐ¾÷)
  15.     ChDir xlPath                 '²¾°Ê(¥Ø¿ý¡^
  16.     Workbooks.Open "a.xls"       '¶}±Ò¥Ø«eªº¸ô®|ªºÀÉ®×
  17. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : °µ¸Ó°µªº¨Æ¬O´¼¼z¡A°µ¤£¸Ó°µªº¨Æ¬O·Mè¡C
ªð¦^¦Cªí ¤W¤@¥DÃD