|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- 没办法,不能对两个Excel进程进行数据交换,只能用临时表格转一下。实现两个进程excel的数据交互。
- Private Sub ConnectSunriseSunSet()
- Dim xlApp As Excel.Application
- Dim xlWk As Workbook
- Dim Sht As Worksheet
- Dim oCount
- Dim Str, Rr, Cc
- Dim Rng As Range
- Dim Arr()
- Str = "中国东西南北城市.xls"
- Set xlApp = New Excel.Application
- ''
- For Each xl In Workbooks
- If xl.Name = "中国东西南北城市.xls" Then
- Set xlWk = xl
- Exit For
- End If
-
- Next xl
- ''Debug.Print xlWk.Name
- Application.Run xlWk.Name & "!MainConnectReturnArr"
- Set Sht = xlWk.Worksheets("Tmp")
- With Sht
- Set Rng = .Cells(1, 1).CurrentRegion
- End With
- Rr = Rng.Rows.Count - 1
- Cc = Rng.Columns.Count - 1
- ReDim Arr(Rr, Cc)
- For ii = 0 To Rr
- For jj = 0 To Cc
- Arr(ii, jj) = Rng(ii + 1, jj + 1)
- Next jj
- Next ii
-
- Stop
- Stop
- Stop
-
- End Sub
复制代码 |
|