ªð¦^¦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!

¦^´_ 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

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

TOP

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD