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

[µo°Ý] ¥i¥H§âvariable©w¸qÀɦW¡H

[µo°Ý] ¥i¥H§âvariable©w¸qÀɦW¡H

Fname ¥i¥H«ç¼Ë©w¸q¤~¦pthisworkbook¤@¼Ë¥i¥Î.name/.path ªº¤èªk¨ú±o¸ô®|¤ÎÀɦW¡H
¦]¬°¦³¦h­ÓÀɮ׻ݭn¦s¨ú¦ÓselectÀɮ׮ɭn¥ÎµuÀɦW¡A¦s¨ú®É«o­n¥Î¨ìªøÀɦW
³o¼Ë·|¥Î¤W¤Ó¦hvariable¦Ó¥B¤ñ¸û²V¶Ã¡C¦³¤èªk¶Ü¡H·PÁ¡I

a = C:\excel
b = abc.xlsx
c = C:\excel\abc.xlsx
  1. Sub Macro1()
  2. Dim Fname As ?????
  3. Fname = "C:\excel\abc.xlsx"
  4. a = Fname.Path
  5. b = Fname.Name
  6. c = Fname.Fullname
  7. End Sub
½Æ»s¥N½X

¦]¬°¦³¦h­ÓÀɮ׻ݭn¦s¨ú¦ÓselectÀɮ׮ɭn¥ÎµuÀɦW¡A¦s¨ú®É«o­n¥Î¨ìªøÀɦWzxcxz µoªí©ó 2014/1/30 20:44

¥i¥H»¡©ú¤@¤U§Aªºª¬ªp?
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE
§Ú·Q±NFname¥i¥H¥Î¤W.name¤Î.path¡AÅý§Ú¥i¥H¥Î Fname.path ¥Nªí C:\excel¡A Fname.name ¥Nªí abc.xlsx
Ãþ¦üthisworkbookªºÃþ§Î¡C

¯¬ ·s¦~¶i¨B¡I

TOP

¦^´_ 3# zxcxz
¬O³o¼Ë¶Ü?
  1. Option Explicit
  2. Sub Macro1()
  3.     Dim Fname As Workbook, A As String, B As String, C As String
  4.     Set Fname = Workbooks.Open("C:\excel\abc.xlsx")
  5.     A = Fname.Path
  6.     B = Fname.Name
  7.     C = Fname.FullName
  8. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE
¤j¬ù¦p¦¹¡A¦ý¥i§_¦b¤£»Ý­n¶}±ÒFname ±¡ªp¤U§@workbook©w¸q¡H
¦]¬°Fname¥i¯à¤w¸g¥Ñ¤H¤â©Î¨ä¥Lsub©Ò¶}±Ò¤F

TOP

¦^´_ 5# zxcxz
¸Õ¸Õ¬Ý
  1. Set Fname = GetObject("C:\excel\abc.xlsx")
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  zxcxz
¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2014-2-1 10:58

«Ü¾A¦X¡I·P¿E:handshake

TOP

¤S¹J¤W·s°ÝÃD©w¸q¬°GetObject«á
Workbooks.Open (Fname.FullName) ¥i¥Î
Fname.Name.Select ¤£¯à¥Î
Windows(Fname.Name).Close ¤£¯à¥Î

TOP

¦^´_ 8# zxcxz
  1. Fname.Activate  ' Workbooks¨S¦³ Select ¤èªk
  2.   Workbooks(Fname.Name).Activate
  3.   Windows(Fname.Name).Close '2003ª©¥i¥Î
  4.   
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 9# GBKEE
Thanks anyway

TOP

        ÀR«ä¦Û¦b : ¦h°µ¦h±o¡C¤Ö°µ¦h¥¢¡C
ªð¦^¦Cªí ¤W¤@¥DÃD