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

INDIRECT°Ñ·Ó¥¼¶}±Òªº¬¡­¶Ã¯

INDIRECT°Ñ·Ó¥¼¶}±Òªº¬¡­¶Ã¯

Google¤F¤@¤U¡A·Q¥ÎVBA¼g¡A¦ý¥Ø«eª¬ªpSub¥i°õ¦æ¦ý¤£¯à§ï¦¨Function¡C
¨D¸Ñ¡Aµ{¦¡½X¦p¤U¡G

(¦¨¥\)
Sub pullout()
    path = "D:\"
    workbookName = "Book1.xls"
    worksheetName = "sheet1"
    CELL = "A1"

    returnedValue = "'" & path & "[" & workbookName & "]" & _
          worksheetName & "'!" & Range(CELL).Address(True, True, xlR1C1)
    Debug.Print returnedValue
    [D2] = ExecuteExcel4Macro(returnedValue)
End Sub


(¥¢±Ñ)
Private Function RETRIEVE(path, workbookName, worksheetName, CELL)

    returnedValue = "'" & path & "[" & workbookName & "]" & worksheetName & "'!" & Range(CELL).Address(True, True, xlR1C1)
    RETRIEVE = ExecuteExcel4Macro(returnedValue)

End Function

ª½±µ¦bsub¤¤©I¥sfunction¬O¥i¥Hªº¡A
¦ý§Ú·Q­nª½±µ¦bÀx¦s®æ¤¤key¤J¤½¦¡¨Ï¥Î¡C

¦p¥H¤Uªþ¥ó¡A½Ð¦U¦ì¤j¤j¸Ñ´b¡A·P®¦!

°Ñ·Ó¥¼¶}±Ò¬¡·~ï.rar (14.25 KB)

TOP

¦^´_ 1# chiata

½Ð¤W¶Ç§A¦p¦ó¥¢±ÑªºÀÉ®×
  1. Option Explicit
  2. Sub Ex()
  3.     MsgBox RETRIEVE("D:\", "BOOK1.XLS", "SHEET1", "A1")
  4. '¥i¶Ç¦^ D:\[BOOK1.XLS]SHEET1!$A$1
  5. End Sub
  6. Private Function RETRIEVE(path, workbookName, worksheetName, CELL)
  7.     Dim returnedValue As String
  8.     returnedValue = "'" & path & "[" & workbookName & "]" & worksheetName & "'!" & Range(CELL).Address(True, True, xlR1C1)
  9.     RETRIEVE = ExecuteExcel4Macro(returnedValue)
  10. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

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