Sub checkclosedfile1()
Dim strpath As String, strfile As String
Dim strsheet As String, strresult As String
strpath = "X:\風管報表\短期股權投資部位及評價控管表"
strfile = "短期股權投資部位及評價控管表1021202.xls"
strsheet = "全公司I"
strresult = getcellvalue(strpath, strfile, strsheet, "i1")
Cells(2, 2) = strresult
End Sub
Public Function getcellvalue(strpath As String, strfile As String, strsheet As String, stra1 As String)
getcellvalue = ExecuteExcel4Macro("'" & "[" & strfile & "]" & strsheet & "'!" & Range(stra1).Address(, , xlR1C1))
End Function作者: stillfish00 時間: 2013-12-16 16:58
Sub nn()
[A1] = ExecuteExcel4Macro("'X:\風管報表\利率交換部位評價表\[IRS交易部位評價表1021216.xls]部位評價表'!R1C13")
End Sub作者: jasonwu0114 時間: 2013-12-18 11:33
本帖最後由 jasonwu0114 於 2013-12-18 11:35 編輯
不好意思已解決如下
請問還可以寫的更SMART嗎??
另外yy = "'X:\風管報表\交換部位評價表\[IRS部位評價表" & kk & ".xls]部位評價表'!R1C13"
R1C13這裡只能是單一欄位嗎??
Sub nn4()
Dim yy As String
Dim kk As Range
Set kk = Sheets("工作表1").Range("A3")
Do While kk <> ""
yy = "'X:\風管報表\交換部位評價表\[IRS部位評價表" & kk & ".xls]部位評價表'!R1C13"
kk.Offset(0, 3) = ExecuteExcel4Macro(yy)
Set kk = kk.Offset(1)
Loop
End Sub作者: stillfish00 時間: 2013-12-18 12:41
=============
This Workbook裡
Private Sub Workbook_Open()
Ex
End Sub
=============
Module1裡放程式
Sub Ex()
Dim Ar As Variant, E As Range, i As Integer
'd:\ 請修改為正確路徑
With GetObject("d:\tttt.csv").Sheets(1)
Ar = Split(Trim(.[a1]), Space(2))
.Parent.Close 0
End With
i = 0
For Each E In ActiveSheet.[A1,A2,B5,E5,C5]
E = Ar(i)
i = i + 1
Next
Application.OnTime Time + #12:00:01 AM#, "工作表1.Ex"
'程式在物件模組 OnTim 要指明 模組名稱
=====================
錯誤訊息
[attach]17225[/attach]作者: GBKEE 時間: 2014-1-9 15:50