- ©«¤l
- 51
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 81
- ÂI¦W
- 0
- §@·~¨t²Î
- Win 7
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-9
- ³Ì«áµn¿ý
- 2013-1-9
|
¥»©«³Ì«á¥Ñ alexliou ©ó 2012-3-28 07:50 ½s¿è
¤]¥i¥H§Q¥Î©I¥sexcel ´£¨Ñªº XLM macro¨Ó¹F¦¨.
©³¤Uªº GetValue Function¦³¥|Ó¤Þ¼Æ :
¡Epath: ¸ê®Æ©Ò¦bÀɮתº¸ô®| (e.g., "d:\Data\ or d:\Data")
¡Efile: ¬¡¶Ã¯¦WºÙ (e.g., "Input.xls" or "Input.xlsx)
¡Esheet: ¤u§@ªí¦WºÙ (e.g., "Sheet1")
¡Eref: §A©ÒnªºÈ©Ò¦bÀx¦s®æªº¦ì§}°Ñ·Ó (e.g., "C5")
Private Function GetValue(path, file, sheet, ref)
' ±q¤@ÓÃö³¬ªº¬¡¶Ã¯¤¤¨ú¸ê®Æ
Dim arg As String
' ½T©wÀɮצs¦b
If Right(path, 1) <> "\" Then path = path & "\"
If Dir(path & file) = "" Then
GetValue = "File Not Found"
Exit Function
End If
' ³]©w°õ¦æXLM Macroªº°Ñ¼Æ
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
' °õ¦æMicrosoft Excel 4.0 ¥¨¶°
GetValue = ExecuteExcel4Macro(arg)
End Function |
|