Professional Documents
Culture Documents
q Excel
1.
2.
3.
Excel
(DDE)
( Ctrl+C ) Excel
Web Ctrl+V
7.1.1 7.1.2
7.1.1
7.1.2
7.1.3
1
7.1.4
() 7.1.5
?
Excel
7.1.5
1. Excel
(
)
()
(
Black-Scholes )
Excel Web Web
2
()(
)
Excel
2. Excel
Excel
Excel
3. Excel
(DDE) Excel
Excel
()
Excel Excel
(!)
Excel
?
1. Excel
Excel
Excel Excel Excel
?
Excel(Excel Application) OnTime
OnTime OnTime
(OnTime )
Private Sub ExeSelf( )
On Error Resume Next
i=i+1
Cells(i,1) = Time
Application.OnTime Now + TimeValue(00:00:01), ThisWorkBook.ExeSelf
End Sub
3
i = i + 1 Time Cells(i,1) =
Time(i
)
Application.OnTime Now + TimeValue(00:00:01),
ThisWorkBook.ExeSelf Application (Excel ) OnTime
(NOW) 1 (TimeValue(00:00:01))(
)(ThisWorkBook) ExeSelf ()
7.1.6
7.1.6 ?
Cells(i, 1) = TimeWorksheets(Sheet2).Cells(i, 1) =
Worksheets(Sheet1).Cells(1,1) Sheet1 Cells(1,1)
Sheet2
(RTDataCollect.xls
) Web (
Web ) Excel http://tw.stock.yahoo.com/s/list.php?
1 ThisWorkbook
Dim i As Single
Private Sub Workbook_Open()
Call ExeSelf
End Sub
Private Sub ExeSelf()
On Error Resume Next
i=i+1
If i = 1 Then
'
Sheets(2).Cells(1, 1) = "Weight"
Sheets(2).Cells(1, 2) = 0.2
Sheets(2).Cells(1, 3) = 0.2
Sheets(2).Cells(1, 4) = 0.1
Sheets(2).Cells(1, 5) = 0.1
Sheets(2).Cells(1, 6) = 0.1
Sheets(2).Cells(1, 7) = 0.1
Sheets(2).Cells(1, 8) = 0.1
Sheets(2).Cells(1, 9) = 0.1
Sheets(2).Cells(1, 10) = "Portfolio Value"
5
'
Sheets(2).Cells(2, 1) = "Time"
Sheets(2).Cells(2, 2) = Sheets(1).Cells(11, 2)
Sheets(2).Cells(2, 3) = Sheets(1).Cells(13, 2)
Sheets(2).Cells(2, 4) = Sheets(1).Cells(14, 2)
Sheets(2).Cells(2, 5) = Sheets(1).Cells(15, 2)
Sheets(2).Cells(2, 6) = Sheets(1).Cells(16, 2)
Sheets(2).Cells(2, 7) = Sheets(1).Cells(17, 2)
Sheets(2).Cells(2, 8) = Sheets(1).Cells(18, 2)
Sheets(2).Cells(2, 9) = Sheets(1).Cells(19, 2)
i=i+2
End If
Sheet1
Sheets(2).Cells(i, 1) = Time
Sheets(2).Cells(i, 2) = Sheets(1).Cells(11, 4)
Sheets(2).Cells(i, 3) = Sheets(1).Cells(13, 4)
Sheets(2).Cells(i, 4) = Sheets(1).Cells(14, 4)
Sheets(2).Cells(i, 5) = Sheets(1).Cells(15, 4)
Sheets(2).Cells(i, 6) = Sheets(1).Cells(16, 4)
Sheets(2).Cells(i, 7) = Sheets(1).Cells(17, 4)
Sheets(2).Cells(i, 8) = Sheets(1).Cells(18, 4)
Sheets(2).Cells(i, 9) = Sheets(1).Cells(19, 4)
Application.OnTime Now + TimeValue("00:02:00"), "ThisWorkBook.ExeSelf"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime Now + TimeValue("00:02:00"), "ThisWorkBook.ExeSelf", , False
End Sub
7.1.7 2
7.1.8
7.1.7
7.1.8
2.
Excel
3.
()
Excel
Excel
Excel Excel
( VB C)
q Excel
1. () Excel
2.
7.2.1
()
()
B4 C4
B11 (1101 ) D11 ( 1101
) 7.2.1 B4 =!B11
C4 =!D11 7.2.1
3. 7.2.1 <=23.5
>=6.5
(1) ( C4) Excel
7.2.2
23.5()
(2) >=23.55
7.2.2
7.2.3
( 7.2.5
)
(3)
7.2.4
(4) IF
J4 =IF(C4<=23.5,"",IF(C4>=23.55,"",""))
J4 C4 7.2.5
7.2.1
7.2.2
7.2.3
7.2.4
7.2.5
Excel
1. Excel
7.2.6
()
10
2.
7.2.6
7.2.8
7.2.7
11
7.2.11
7.2.9
7.2.12
3.
4.
7.2.10
Excel 7.2.13
7.2.13
7.2.14
12
5.
7.2.14
Excel
7.2.15
7.2.16
7.2.15
13
7.2.16
6.
7.
8.
A
B 1 2 C3
(
)
(1)
(CommandButton)
7.2.17 (2)(
) 7.2.18 (3)(
) 7.2.19
(ActiveWindow.Zoom = 100
100)(iv) Excel
50
( 7.2.20 ) 7.2.20 100%
( 200
)
7.2.17
14
7.2.18
7.2.19
7.2.20
15
qExcel VBA
qOnTime
Application OnTime
(DDE) Excel
OnTime
1. (000000)
Now + TimeValue(time) ()
TimeValue(time)
2.
Sub myTest
Msgbox
Application.OnTime Now + TimeValue("00:00:03") , myTest
End Sub
OnTime
OnTime Excel
Schedule False
Workbook_beforeClose OnTime
OnTime
Private Sub Workbook_BeforeClose
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:10") , myTest, Schedule:=False
End Sub
qWorksheet_calculate
Worksheet
Calculate Worksheet
16
Calculate
OnTime
Calculate
Private Sub Worksheet_Calculate()
Msgbox
End Sub
Calculate
Worksheet_Calculate
Else
Exit sub
End if
End Sub
Calculate
OnTime
4-4
4- 4 OnTime Worksheet_Calculate DDE
DDE
Ontime
Worksheet_Calculate
Application.Ontime_
Now+TimeValue("00:00:01") private Sub Worksheet_Calculate
Excel2002
Excel2002
17
q
q
1()
2
3- 3
DDE
RTF(Road
to The
Future)
RTF(Road
to The
Future)
*
*
*
/HTS
/HTS
*
*
*
2007 3 (?)
3()()
q
DDE
5-1
5- 1
Yahoo
PCHOME
2007 4 11
AM 845 PM 145
2007 4 18
18
RAM
Service Pack2
40
IE
yahooPchome
PCHOME
YAHOO
5 20 YAHOO
YAHOO
YAHOO
PCHOME
(1)
(2)(3)
q I
19
6- 2
3
2.
6- 6
20
1.
6-7
6- 8
6-9
6- 9
3
6- 10
21
6- 11
6- 12
6- 13
6- 14
6- 15
6- 16
22
q II
q
1.
2.
6- 10 CB
CB ()
T+2
CB CB
T+3
CBEC
T+8
T+9
S+1
()
S+2
6- 17
23
6- 20
24
4/
CB
10
20
6- 21
6- 22
6- 23
25
q
q
1()
2
3
4()
5
6
7
q
1 =
2
3
4 ( S + C )(1 k ) F ( S + C )(1 + k )
5 DDE Web Connection
q
(
)
( 35 )
26