是德科技
直播中

王莉

7年用户 1269经验值
私信 关注
[问答]

帮助通过ActiveX将数组变量传递给Excel

嗨伙计们,我试图通过ActiveX /公式对象将601点的数组变量传递给Excel工作表。
我尝试了下面的代码,但它的作用是将数组的第一项放在所有601单元格中。
Excel工作表名称为“TRACE DATA”,变量是601实数的数组,在数组变量TRACEDATA_8563中。这是公式对象中的代码:ExcelApp.Sheets(“TRACE DATA”)。范围(“B1:
B601" )值= TRACEDATA_8563。
任何建议将不胜感激。
谢谢达米安。
dgoderich@gmail.com

以上来自于谷歌翻译


     以下为原文

  Hi Folks,
I am trying to pass an array variable of 601 points to an Excel sheet via ActiveX/formula object.  I have tried the following code below but what it does is it places the first item of the array in all 601 cells.

The Excel sheet name is "TRACE DATA", the variable which is an array of 601 real numbers is in the array variable TRACEDATA_8563

Here is the code in the formula object:   

ExcelApp.Sheets("TRACE DATA").Range("B1:B601").Value=TRACEDATA_8563;

Any suggestions will be appreciated.

Thanks
Damian.
dgoderich@gmail.com  

回帖(2)

刁文洁

2018-12-10 16:45:36
我没有看到附加任何代码,无论如何,你应该只使用一个单元格,如果你在这个单元格中放置一个数组,excel将自动增强它。
您可以选择数据之前是垂直还是水平。
你为此使用ecxel lib吗?
或者换句话说,你使用的是什么样的版本?
9.31?
德特勒夫

以上来自于谷歌翻译


     以下为原文

  I do not see any code attached, anyhow, you should just use one cell, and if you put an array in this cell, excel will enhance it atomatically.
You can choose if your data should go vertical or horizontal before. Do you use ecxel lib  for this? or in other words, what vee version are you using? 9.31 ?

detlef
举报

王莉

2018-12-10 16:53:55
回答了我自己的问题:第1个*声明变量* Amp_range名称Amp_range:范围:GLOBAL类型:对象子类型:任何TRACEDATA_8563作为从频谱分析仪保持601个点的变量数组。
A:保持单元格范围的变量* INSIDE FORMULA BOX(ActiveX)* SET Amp_range = excelApplication.Sheets(“TRACE DATA”)。范围(A);
Amp_range = transpose([TRACEDATA_8563])如果任何有类似问题的人都不清楚这一点,我可以发布一个包含所有代码的VEE文件。
达米安。

以上来自于谷歌翻译


     以下为原文

  Answered my own question:

1st *Declare variable* Amp_range

Name Amp_range:  
Scope:GLOBAL
Type: Object
Sub Type:Any

TRACEDATA_8563 Being the variable array holding 601 points from Spectrum Analyzer.
A: being variable holding the range of cells

*INSIDE FORMULA BOX (ActiveX)*SET Amp_range = excelApplication.Sheets("TRACE DATA").Range(A);
Amp_range = transpose ([TRACEDATA_8563 ])

If this is not clear to anyone with a similiar question, I can post a VEE File with all the Code.

Damian.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分