Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am looking for the way to retrieve a cell data from Straight or Pivot tables. Basically, I need to have an option to click on the table (right click - to avoid selections, for example) and get the cell's value along with Row and Column number.
Copy the cell value to clipboard will not work in my case since I need to know cell's coordinates.
I need to report that specic cell (Column # = A and Row # = B) has a value = C.
Is it possible?
Looking forward to your suggestions.
Best regards,
Vladimir
I think the only way is to use a macro and that's only possible if you know in advance which row and column you want. There's no click event api for chart objects that can be used.
Sub GetCellValue
RowNo=6
ColNo=2
set obj = ActiveDocument.GetSheetObject( "CH01" )
set cell = obj.GetCell(RowNo,ColNo)
msgbox(cell.Text)
end sub
Gysbert,
Unfortunatelly, I will not know which cell customer would like to select.
I have up to 200 columns in one chart (scrollable) and I was looking for the option to "highlight" the specific cell (or range of cells) and copy/paste them into some report (excel file, for example).
But thanks for your reply.
Regards,
Vladimir
Vlad, this is probably only possible with an extension object since you can write custom context-menu behavior in JS. Writing an entire extension object just to capture this behavior sounds a bit overkill to me though...In a regular pivot table, when a user clicks on an expression cell, it already automatically highlights (i.e. selects) the dimensions that pertain to that cell. You would then just need to copy the entire table contents, which would give you what you want.
Hope all is well,
Vlad
Vlad,
How are you doing?
I do not have much experience implementing extensions, but if remember correctly they could not be executed under IE Plugin. It might be a problem in my case.
Have you seen any examples of this kind of extension objects?
Thank you for your help!
Regards,
Vladimir
No, I've never seen this kind of object, it would have to me developed from scratch (like I said, probably not worth the effort).
You can't make the regular pivot table highlighting work for your purposes (when you click an expression value)?
Vlad
Read the rows and colums like below and write it in a file. This works also in IE-Plugin.
sub ReadRowColumnValues
dim fso, File, doc, source, iRow, iCol, cell, str
set doc = ActiveDocument
set source = doc.GetSheetObject("CH02")
set fso = CreateObject("Scripting.FileSystemObject")
set File = fso.OpenTextFile(YOUR PATH+FILE.txt, 2, true)
for iRow = 1 to source.GetRowCount - 1
for iCol = 1 to source.GetColumnCount - 1
set cell_1 = source.GetCell(iRow, iCol)
str = "Row " & iRow & " - " & "Column " & iCol & " - " & "Value " & cell.Text
'msgbox str
File.WriteLine str
next
next
File.Close
set fso = nothing
set File = nothing
set doc = nothing
set source = nothing
end sub
Marcus
Markus,
Thank you for your suggestion, but it will not work in my case. I can achive the same results by using ExportEx method (which will also give me formatting of the original table in Excel file).
I need to "extract" a single cell without entering it Row and Column numbers.
I am trying to develop a mechanism when user can click on single cell or column and "report" values from this cell or column to external file.
Regards,
Vladimir
Vlad,
Selection works, but I just need to know (at least) which expression I've clicked on.
Is it possible to detect?
Regards,
Vladimir
No, that's not possible as far as I'm aware.
Vlad