???????? ??????? ??? ?? ??? Excel ????????????? ?? ??? ???? ??????????? ???? ?? ??? ???????? approach ?? ??????? ??? ??????? ???? ?? ????????????? ?? ??? ??? ?? ??? ?? ??? ????????????? ?? ???????? ?? ??????? ???????? ?? ????? ??? ????? ?? ?????? ??? ???? ???? ?? ????? ????????? ???? ?? ??? greatest ????????????? ??? ???????, ?? ??? ?? ?? approaches ?? ???? ???? ??????????? ???? ?? ??? ????? ?? ????:
- ???? ?? ???? ?? ???? ??????????? ????
- ?? ?????? ?? ?????? ?? ??? ???? ???? ??? ???? ??????????? ????
- ??? ADO recordset ??? ???? ?? ????? ???? ??? ?? ?????? ?? ?????? ?? ??????????? ????CopyFromRecordset????
- ????? ???QueryTable??? ODBC ?? OLEDB ???? ????? ?? ?? ?????? ?? ?????? ??? Excel ??????????
- ?????????? ?? ???? ??????????? ???? ?? ???? ??? ?????????? ??????? ?? ???? Excel ????? ????? ??? ???????
?? ??????? ??? ????? ????? ?? Excel ??? ???? ??????????? ???? ?? ??? ?? ???? ??? ?? ??????? ?? necessarily ???????? ????? ??? ?? ???? ????????? ?????-???? ??? ??? ???, ?? ?? ????? approach ??????? ???? ?? ??? ???? ??????? ???? ?? ???? ?????? ??? ???? ?? ??? ?? ???? ??? ??????? ??? ???? ???? ???? ??????????? ???? ?? ??? ????? ??????? ????? ???? ?? ???? ??:
- ???? ???? ??????????? ???? ?? ??? ??? ?? ?????????-???????? ??? ???? Excel ????? ??? ??? ?? ???? ??? ?? ???? ??? ???? ?????????? ??
- ???? ???? ?? ???? ?????????? ADO ?? ????? ???? ?? ??? ??????????? ????
- ???????? ???? Exchange ?? ????? ?? Excel ??? ???? ??????????? (DDE)
????? ???????? ?? ?? ???????? ?? ???? ????? ?????? ????? ???
???:?? ?? Microsoft Office Excel 2007 ?? ?????, ????? ?? ???? ??? Excel 2007 ????????????? (*.xlsx) ?? ?? ????? ?????? ?? ?? ????????????? ?? ??????? ??? ???? ?? ???, ????? ??? ???????? ??? ??? ?? ????? ?????? ?? ?????:
oBook.SaveAs "C:\Book1.xls"
??? ?? ????? ?????? ?? ??? ?? ??? ?? ???????????? ????:
oBook.SaveAs "C:\Book1.xlsx"
??? ??, ????????? ??????? ??? ????? ???? ???? Office 2007 ???????? ??? ??? ???????, ?? ??????? ?? ???? ??? ????????? ??????? ?? Microsoft Office Online.
???? ?? ???? ?? ???? ??????????? ???? ?? ??? ??????? ?? ????? ????
???????, ?? ??? ?? ??????????? ?? ???? ??? ???? ?????????? ?? ???? ?? ??? ?? ???:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Last Name"
oSheet.Range("B1").Value = "First Name"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "Doe"
oSheet.Range("B2").Value = "John"
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\Book1.xls"
oExcel.Quit???? ?? ???? ?? ???? ??????????? ?? ??? ?? ???? ??? ??? perfectly ????????? approach ??? ???? ?? ?????? ???? ??? ?? ????????????? ??? ???? ?? ???? ???? ?? ??? ??? ?? ?? ?? ???????? ???? ?????? ???? ?? ????? ???? ???????, ?? approach ??
??????? ???? ??? ??? ?????? ??? ???? ?? Excel ????????????? ???? ?? ??????????? ???? ?? ??? ????????? ????????
?????????????? ?? ??? ???????? ?? ?????? ??? ????? ??? ?????? ??????? ?? ?? ????? ?? ???? ??????????? ?? ??? ?? ???? ???? ??? ??? ??, Microsoft Windows 95 ?? Windows 98 ?? 64 K ??? ??????? ???????? ??? ??? ?? ?? ??????? ?? ?? ?? ???? 64 k ??????? ???????? ?? ????? ??, (Excel) ??????? ????? ??????????? ???? ??? ?? ???? ?? ?? ????????? ?? ?? ?????? ????? ??????? ?? ???? ??? Windows 95 ?? Windows 98 ?? ??? ?? ??? ?? ????? ???????? ???? ??? discussed ??:
216400
(http://support.microsoft.com/kb/216400/
)
?????-????????? COM ??????? ?? ??? 95/98 ??????? ????????? ???? ?? ???? ???
?? ??? ??, ???? ?? ???? ?? ???? ??????????? ?? ??? ?? ???? ???? ?? ?????? ?? ???? ?? ??? ????????? ??? ??? ???? Excel ?? ??? ???? ??? ?? ??????????? ???? ?? ???, ???? ?? ?????? ??? ??? ???????? ??? ?? ????? ???? ??????
Excel ?? ??????? ?? ??? ???? ????? ???, ?? ??? ????? ?????????? ???? ?? Microsoft ???????? ??? ?????:
219151
(http://support.microsoft.com/kb/219151/
)
Visual Basic ?? Microsoft Excel ?? ??????? ???? ????
???? ?????????? ?? ???? ?????? ?? ??? ???? ?? ???? ??????????? ???? ?? ??? ??????? ?? ????? ????
???? ?? ???? ??????????? ???? ?? ???? ?????? ?????? ?? ?????? ??? ?? ???:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
'Create an array with 3 columns and 100 rows
Dim DataArray(1 To 100, 1 To 3) As Variant
Dim r As Integer
For r = 1 To 100
DataArray(r, 1) = "ORD" & Format(r, "0000")
DataArray(r, 2) = Rnd() * 1000
DataArray(r, 3) = DataArray(r, 2) * 0.7
Next
'Add headers to the worksheet on row 1
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1:C1").Value = Array("Order ID", "Amount", "Tax")
'Transfer the array to the worksheet starting at cell A2
oSheet.Range("A2").Resize(100, 3).Value = DataArray
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\Book1.xls"
oExcel.Quit??? ?? ?????????? ???? ???? ?? ???? ???? ?? ????? ?? ?? ???? ???? ?? ????, ?? ?? ???? ??? realize ?? enormous ??????????? ??????? ???? ?? ?? ???? ?????? ?? ???? ??? ??? 300 ?????? ?? ?????????? ??? ???? ??????????? ???? ?? ?? ?? ?? ?????? ?? ????? ????:
oSheet.Range("A2").Resize(100, 3).Value = DataArray?? ?????? ???????? ?? ?? ???????? ?? ???????????? ???? ?? (?? ?? ???
???????? ????????
?????????? ???? ?? ?? ????? ?? ???
???????? ????????
???? ?????????) ????? ?? ????? ???, ???? ?? ???? ???? ??????????? ?? ??? ?? ???? ?????? ?????? ???? ?? ??? 300 ??????? ?? ???
?????????????? ??? ???? ??, ?? ?? ?? ???? ???? ?? ???? ?????? ??? ??????????? ?? ??? ?? ?? ???????? ?? ?????? ???? ?? ?? ?? ?????? ?? ?? ?? ??? ?? ???? ????
??? ADO recordset ???? ?????????? ?????? ??? ??????????? ???? ?? ??? ??????? ?? ????? ????
Excel 2000 ????????
CopyFromRecordset???? ADO (?? DAO) recordset ?? ???? ?????????? ?? ???? ?????? ?? ??????????? ???? ?? ?????? ???? ??? ????? ??? illustrates ???? ?? ??? Excel 2000, Excel 2002 ?? Office Excel 2003 ??? ???????? ?? ????????? ????? ??????? ????? ??? ???? ?????? ?? ??????? ?? ??????????? ????
CopyFromRecordset?????? ???
'Create a Recordset from all the records in the Orders table
Dim sNWind As String
Dim conn As New ADODB.Connection
Dim rs As ADODB.Recordset
sNWind = _
"C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
sNWind & ";"
conn.CursorLocation = adUseClient
Set rs = conn.Execute("Orders", , adCmdTable)
'Create a new workbook in Excel
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
'Transfer the data to Excel
oSheet.Range("A1").CopyFromRecordset rs
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\Book1.xls"
oExcel.Quit
'Close the connection
rs.Close
conn.Close ???:??? ?? Office 2007 ??????? ????????? ??????? ?? ????? ????, ???? ??? ?? ?????? ??? ??? ?? ????? ?????? ?? ???????????? ???? ?????:
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ sNWind & ";"
??? ?? ?? ?????? ??? ?? ????? ?????? ?? ???????????? ????:
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _ sNWind & ";"
Excel 97 ?? ?????? ????? ?? ??
CopyFromRecordset???? ????? ?? ??? ????? ?? ???? ?? DAO recordset ?? ????
CopyFromRecordsetExcel 97 ?? ?????? ???? ???? ADO.
ADO ?? ????? ???? ?? ???? ??? ???? ??????? ?? ??? ??
CopyFromRecordset???? ?? ???, ????? ????? ???? ?? Microsoft ???????? ??? ?????:
246335
(http://support.microsoft.com/kb/246335/
)
??????????? ???? ?? ??? ???? ?? ??? ADO recordset Excel ??????? ?? ??? ???? ????
???? ?????????? ?? ??? QueryTable ?? ????? ?? ??? ??????? ?? ????? ????
A
QueryTable???????? ???? ?????? ??? ???? ????? ???? ????? ?? ??? ?? ???? ?? ????? ?? ???????????? ???? ??? Microsoft Excel ?? ??????? ????, ??? ??? ???? ???, ?? ????
QueryTable????? ?? OLEDB ?? ??? ODBC ???? ?? ??? ??? ??????? ???????? ?????? ?? ???? ????? ???? SQL ???????? ?? ???? Excel recordset ????? ?? ??? ?? ?? ???? ????????? ????? ?? ?????????? ??? ???????? ???? ?? ??? ???????????? ????? ??? ?? ????? ????
QueryTables?? ????? ?? ???????? ???? ??
CopyFromRecordset????:
- Excel recordset ?? ???? ????????? ?????????? ??? ?? ??????? ??????? ???
- ?????? ?? ??? ????? ?? ????QueryTable????? ?? ?? ??? ?????? recordset ??????? ???? ?? ??? ???? ?? ??? ?? ???? ?? ?? ???? ????
- ?? ??? ???QueryTable????? ??? ?? ???? ????????????? ?? ??? ????????? ?? ???? ?? ?? ???? ?? ???????? ???? ?? ??? ???? ?? ?? ?????? ?????????? ?? ?????? ??? ???? shifted ???? ?? ???? ?? (?????RefreshStyle??? ????? ?? ???)?
????? ??? ????????? ???? ?? ?? ???? ?? Excel 2000, Excel 2002 ?? Office Excel 2003 ?? ??? ????? ?? ??? ???????? ???
QueryTable????????? ????? ?? ???? ?? ????? ?? ???? Excel ?????????? ??? ???????:
'Create a new workbook in Excel
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
'Create the QueryTable
Dim sNWind As String
sNWind = _
"C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
Dim oQryTable As Object
Set oQryTable = oSheet.QueryTables.Add( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
sNWind & ";", oSheet.Range("A1"), "Select * from Orders")
oQryTable.RefreshStyle = xlInsertEntireRows
oQryTable.Refresh False
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\Book1.xls"
oExcel.Quit?????????? ?? ????? ????
Windows ?????????? ?? ???? ?????????? ??? ???? ??????????? ???? ?? ??? ?? ?????????? ?? ??? ??? ????? ???? ?? ???? ??? ???? ?????????? ?? ?? ?? ???? ?????? ??? ???? ???????, ???? ????? ???????? ??? ???? ?? ??? ??? ?? ????????? ???????? carriage ???? ?? ??? ???, ?? ???????? ????????? ?? ???? ???? ????? ??? illustrates ???? Visual Basic ????? ?? ???? ???? ?????????? ???????? Excel ??? ???? ??????????? ???? ?? ???:
'Copy a string to the clipboard
Dim sData As String
sData = "FirstName" & vbTab & "LastName" & vbTab & "Birthdate" & vbCr _
& "Bill" & vbTab & "Brown" & vbTab & "2/5/85" & vbCr _
& "Joe" & vbTab & "Thomas" & vbTab & "1/1/91"
Clipboard.Clear
Clipboard.SetText sData
'Create a new workbook in Excel
Dim oExcel As Object
Dim oBook As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
'Paste the data
oBook.Worksheets(1).Range("A1").Select
oBook.Worksheets(1).Paste
'Save the Workbook and Quit Excel
oBook.SaveAs "C:\Book1.xls"
oExcel.QuitExcel ??? ????????? ?? ??????? ?? ????? ?? ???? ??? ?? ???????? ??? ???? ?????
Excel ??? ?? ?????????-???????? ?????? ?? ????? ?? ?????? ??? ???? ??? ?????? ?? ????? ?? ???? ???? ?? ?? ??, ??? ??? ??, ??????? ?? ????? ???? ??? ??? ?????????? ?? ??? ??? ?????? ??? ???? ??????????? ???? ????? ??? ?? ?? ?? ?????? ?? ??? ?? ???? ???? ??? ????? ???? ?????-???? ?? ???? ??????? ?? ?? ???????-????? ????????? ?? ??? ?? ????? approach ?? ???? ??? ?? ?? ???? ?? ???? ??????? ?? ?????, ??????? ?? ??? ????? ?? ??? ?????
????? ??? illustrates ?? ?? ?? ??? ADO recordset ?? ?? ?????????-???????? ??? ????? ??? ???? ???:
'Create a Recordset from all the records in the Orders table
Dim sNWind As String
Dim conn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim sData As String
sNWind = _
"C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
sNWind & ";"
conn.CursorLocation = adUseClient
Set rs = conn.Execute("Orders", , adCmdTable)
'Save the recordset as a tab-delimited file
sData = rs.GetString(adClipString, , vbTab, vbCr, vbNullString)
Open "C:\Test.txt" For Output As #1
Print #1, sData
Close #1
'Close the connection
rs.Close
conn.Close
'Open the new text file in Excel
Shell "C:\Program Files\Microsoft Office\Office\Excel.exe " & _
Chr(34) & "C:\Test.txt" & Chr(34), vbMaximizedFocus ???:??? ?? Office 2007 ??????? ????????? ??????? ?? ????? ????, ???? ??? ?? ?????? ??? ??? ?? ????? ?????? ?? ???????????? ???? ?????:
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
sNWind & ";"??? ?? ?? ?????? ??? ?? ????? ?????? ?? ???????????? ????:
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
sNWind & ";"??? ???? ??? ????? ??? ??? .CSV ????????? ??, ?? Excel ??? ???? ??????? ??? ????????? ??? ???? ???? ????? ?? ?? ???????? ??? ?? ????? ?? ?? ????? ?? ?????????-????????? ??? ??????, ??? ???? ????? ??? ??? .TXT ????????? ??, Excel ???? ?? ????? ??? ??????? ?? ????? ???? ??????
????? ??? ????? ??? Excel ?? ????? ?? ????? ????
?????? ?? ????? ?? ??? ???? ???? ?????? ???? ?? ??? ??? ????? ???? ??? ??? ????? ????? ??? ??? ??????? ?? ????? ???? ??? ??? ??? ??, ??? ?? ?????, ?? ?? ??? ??????? ?? ?? ??????? ?????? ?? ????? ??? ???? ????? ?? ??? Excel ????????????? ?????? ??? ??????:
'Create a new instance of Excel
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
'Open the text file
Set oBook = oExcel.Workbooks.Open("C:\Test.txt")
'Save as Excel workbook and Quit Excel
oBook.SaveAs "C:\Book1.xls", xlWorkbookNormal
oExcel.Quit????? i/O ?? ???? ????? ??? ????????? ??? ????? ?? ???? ??? ???? ??????? ?? ??? ????? ????? ???? ?? Microsoft ???????? ??? ?????:
172267
(http://support.microsoft.com/kb/172267/
)
????????? ???? ?? RECEDIT.VBP ?? Visual Basic ??? ????? i/O
ADO ?? ????? ?? ???? ?????????? ?? ??? ???? ?? ??????????
Microsoft Jet OLE DB ??????? ?? ????? ??, ?? ?? ???? ??? ?????? ??? ???? ?????? ??? ??? ?????? Excel ????????????? ?? ???? "??????" Excel ??? ????????? ??? ?? ??? merely ?????? ??? ?????? ?? ???? ?????? ????? ??? (?? ????? ???) ??? ???? ?????, ?? ??? ?? ??? ????????? ?? ??????? ??? ??? ????? ????? ?? ???? illustrate ???? ??? ???? ??? ??? ????????????? ???? ????? ?????? ??? ?? ???
MyTable.
Excel 97, Excel 2000 ?? Excel 2003
- ??? ?? ????????????? ??? Excel ??????? ?????
- ????? ??? ?? ????? ??? Sheet1 ?? ???? A1:B1 ??? ??????:
A1: FirstName B1: LastName - ??? B1 ???? ?? ??????? ???? ?? ??? ??? ???????? ?????
- A1:B1 ?? ??? ?????
- ????? ???????????? ????????, ' ?????????? ??? ?? ??? ????????????? ????. ??? ???? ????MyTable?? ????? ????OK.
- ?? ????????????? ?? C:\Book1.xls ?? ??? ??? ?????? ?? Excel ?? ???? ???
???? ?? ??? ?????? ????? ?? ???
MyTableADO ?? ????? ??, ?? ?? ???? ??? ??? ?? ????? ????? ?? ???? ???? ??:
'Create a new connection object for Book1.xls
Dim conn As New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Book1.xls;Extended Properties=Excel 8.0;"
conn.Execute "Insert into MyTable (FirstName, LastName)" & _
" values ('Bill', 'Brown')"
conn.Execute "Insert into MyTable (FirstName, LastName)" & _
" values ('Joe', 'Thomas')"
conn.CloseExcel 2007
- Excel 2007 ???, ???? ?? ????????????? ??????? ?????
- ????? ??? ?? ????? ??? Sheet1 ?? ???? A1:B1 ??? ??????:
A1: FirstName B1: LastName - ??? B1 ???? ?? ??????? ???? ?? ??? ??? ???????? ?????
- A1:B1 ?? ??? ?????
- ???? ?? ????? ???????????? ????? ????, ?? ???? ?????? ????????? ????. ?? ??? ?????MyTable?? ????-????? ????, ?? ???? ???OK.
- ?? ????????????? ?? C:\Book1.xlsx ?? ??? ??? ??????, ?? ?? Excel ?? ???? ???????
????? ?? ??? ?????? MyTable ?????? ADO ?? ????? ???? ???, ????? ??? ?? ?????? ?? ???? ???? ?? ?? ??? ?? ????? ?????
'Create a new connection object for Book1.xls
Dim conn As New ADODB.Connection
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=C:\Book1.xlsx;Extended Properties=Excel 12.0;"
conn.Execute "Insert into MyTable (FirstName, LastName)" & _
" values ('Scott', 'Brown')"
conn.Execute "Insert into MyTable (FirstName, LastName)" & _
" values ('Jane', 'Dow')"
conn.Close?? ?? ?? ????? ?? ?????? ??? ?????? ???, ????????????? ?? ??????? ???? ??? ????? ?????? ??? ??? ????? ?? ????? B ????? ???? ?????? ?? ??? ???????? ???? ???? ???? ?????? ??? ????? ?? ?? ???????? ?????? borrows ??? ??? ?? ?????? ?? ??????? ???
?? ???????? ?? ?? ???? ???? ?? ?????? ?? ?????????? ??? ??? ?????? ????? ??, ?? ?? ???? ?? ?????? ??? ???? ?? ??? ?? ???? ??? ?????; ??? ????? ?????? ???, ?????????? ????????? ??? ???? "???" ?? ?? ?????? ??? ????? ??? ???? ????? ???? ?? ????? ??? ?? ???? ???????????? ?? ???? ?? ????? designing.
???:ADO ?? ????? ?? ?? DAO ?? ????? ?? ???? Excel ????? ????? ??? ???? ?? ?????? ???? ?? ??? ???? ??? ???? Visual Basic ??? ????? ??? ????????? ?????? ?? ??? Office 2003 ?????? ??? 2 (SP2) ?? ??????? ???? ?? ??? ?? Access 2002 904018 Microsoft ???????? ???? ??? ????? ???? ?? ??? ?????? ?? ??????? ???? ?? ???? ???? Office ?????????, ???? ????, Excel ?? Outlook ?? ????????? ?????? ?? ??? Visual Basic ??? ?? ???? ??? ???? ??????? ??????? ?? ???, Microsoft ?????? ??? ??? ???? ????? ?? ??? ????? ???? ???????? ????? ????::
904953
(http://support.microsoft.com/kb/904953/
)
?? ???? ?????, ?????? ?? Office Access 2003 ?? Access 2002 ??? ??? Excel ????????????? ?? ???? ?? ???????? ??? ???? ?????
904018
(http://support.microsoft.com/kb/904018/
)
Access 2002 ?? ??? ?????? ?? ?????: 18 ???????, 2005
???????? ??????? ?? ??? ADO ?? ????? ?? Excel ????????????? ???? ?? ??????? ?? ???, ????? ????? ?????? ?? Microsoft ???????? ??? ?????:
195951
(http://support.microsoft.com/kb/195951/
)
?????? ?? ASP ?? ADO ?? ????? ?? Excel ???? ?????? ???? ?? ??? ???? ????
Excel ??? ???? ??????????? ???? ?? ??? DDE ?? ????? ????
DDE ?? Excel ?? ??? ????? ???? ?? ???? ??????????? ???? ?? ??? ?? ?????? ?? ??? ??? ??????? ?? ??? ??? ???????? ??; ???????, ??????? ?? COM advent ?? ??? DDE ?? ???? ??????????? ?? ??? ????? ???? ?? ??? ?????? ??????? ???? ?? ?? ???? ????? ???? ???? ????? ?? ??? ?????? ???? ?? ??? ?????? ???
DDE ?? ????? ?? Excel ??? ???? ?? ??????????? ???? ?? ??? ?? ?? ?? ???? ???:
- ?????LinkPoke???? ???, ???? ??????? ?????? ?? ??? ???? poke ???? ?? ??? ????
-??- - ?????LinkExecuteExcel ?? ???? ????? ?? ??? ?????? ????????? ??????
????? ??? ?????? ?? ?? DDE ?? ??????? ???? ?? ??? ???? illustrates Excel ?? ??? ?????? ???? ????? ?? ?? ???? ?????????? ?? ?????? ??? ???? poke ???? ????????? ?? ???? ???? ?? DDE ????????? ?? ??????????? ??????? ???? ?? ???? ???? ?? ???, ?? ????? ?? ????? ?? ??? ??
LinkTopicExcel|MyBook.xls, ??? ?? ??? ???? ?????????????
MyBook.xls???? ?? ???? ???? ????? Excel ?? ???? ?? ??? ???????? ????
???:?? ?? Excel 2007 ?? ????? ?? ????????????? ?? ?????? ?? ??? ?? .xlsx ????? ?????? ????? ?? ????? ????????? ???? ?? ???? ??? ??? ????? ??? ?????? ?? ?????? ???
???:?? ?????? ???,
Text1?? ???????????? ???? ?? ??
??? ????????? Visual Basic ??????? ?? ????????:
'Initiate a DDE communication with Excel
Text1.LinkMode = 0
Text1.LinkTopic = "Excel|MyBook.xls"
Text1.LinkItem = "R1C1:R2C3"
Text1.LinkMode = 1
'Poke the text in Text1 to the R1C1:R2C3 in MyBook.xls
Text1.Text = "one" & vbTab & "two" & vbTab & "three" & vbCr & _
"four" & vbTab & "five" & vbTab & "six"
Text1.LinkPoke
'Execute commands to select cell A1 (same as R1C1) and change the font
'format
Text1.LinkExecute "[SELECT(""R1C1"")]"
Text1.LinkExecute "[FONT.PROPERTIES(""Times New Roman"",""Bold"",10)]"
'Terminate the DDE communication
Text1.LinkMode = 0?? ????? ???? ???
LinkPokeExcel, ?? ??? ????????? ?????? ?? ??? ??????-????? (R1C1) ?? ???? ???
LinkItem. ??? ?? ?? ?? ???? ?????? ??? ???? poking ???, ?? ?? ???? ????? ???????? ????? ?? ??? ??? ?? ????????? ???????? carriage ???? ?? ??? ???, ?? ???????? ?? ????? ?? ?????
?? ?? ????? ????
LinkExecuteExcel ???? ???? ???? ???? ?? ??? ?????, ?? ??? ?? ???? ?????? Excel ??????? ???????? ?? Excel ?????? ???? (XLM) ??? ??? XLM ???????? 97 ?? ??? ??? Excel ??????? ?? ??? ????? ???? ??? ???? ??????? ?? ??? ?? ?? XLM ???????? ??????? ?? ???? ???, ????? ????? ???? ?? Microsoft ???????? ??? ?????:
143466
(http://support.microsoft.com/kb/143466/
)
Macro97.exe ????? ?????? ?????? ?????? ??
DDE Excel ?? ??? ????? ???? ?? ??? ???????? ?????? ???? ??? ??????? greatest ??? ?????? ???? ?? ?? ?? Excel ??? ??? ???? ?? ??? ?? ???????? ?? ??? ?? ???? ????? ???? ???