PowerPoint VBA to get selected cell and row and column - powerpoint

I am trying to use VBA and C# to determine the selected range of cells in a PowerPoint table. Ideally, I could use something like the .Start and .End properties of the selected range of cells to identify the row and column boundaries of the selected range of cells, but I could find no such properties.
But I cannot find any way to get the cell coordinates from the selection object. I want to use something like this:
var startColumn = selection.ShapeRange.Table.<selected cellrange>.Start;
The only thing I found that was even close was some code that looped over each cell in the selected table object asking if each cell was selected.
For x = 1 To oTbl.Rows.Count
For y = 1 To oTbl.Columns.Count
If oTbl.Cell(x, y).Selected Then
' do something with the selected cell or indexes
End If
Next
Next
Is that the only way for me to determine the row and column of the selected cell, or is there a shorter way? Thank you.

#Steve Rindsberg confirmed that PowerPoint has no functions for this sort of thing. I used the code shown above to traverse the table cells to find the selected region.

Related

In the Format cells dialog box, under category General, how to remove 0 from the sample box?

When we are pulling values from another sheet, if there is nothing in a particular cell, then it should return the same instead of returning Zero
I tried to remove the zero from sample section. but i doesn't know how to do that

Delphi: auto addition in StringGrid

It is possible to make a calculator who calculate the addition of 2 or more cells of a StringGrid and show the result in other cell?
For example:
I have a String grid with 6 cells. I want to show in the 6th cell 1st cell+2nd cell+3rd cell+4th cell+5th cell.
And if the response is 'YES' how can I do this?
Yes, it's certainly possible to write such a program.
Read the values in the cells, convert them to integers, add them, convert the result back to a string, and store that string in the cell designated for the result.
To detect changes to the editable cells, you might wish to handle the OnSetEditText event of the grid control.

Change VB6 cell properties on runtime?

I have a table with a foo number of rows and bar number of columns.
What i'd like is for the selected cell to really appear as being selected.
At the moment the leftmost cell gets a red text to mark it's being selected.
What i'd llike is for the lines at the top and bottom of the cell to get bigger to really show that the cell is selected.
I've looked at the following but without success.
grd.row = aRow
grd.col = aCol
' Therafter i try to change the following:
grd.CellBorderColor = 255 ' Original value does not change
grd.CellBorderStyle = 2 ' Original value does not change
EDIT:
I found out that previously named properties are read only.. What can i do?
Any tips and/or pointers in the right direction will be highly appreciated, thanks for reading.
This particular grid. Called vaSpread or fpSpread needs a specific line to execute.
For executing changes to grid style you need to call grid.action = 13 after you've written the visual changes to the grid.

List Control Adds a Space for an Image to Column 0 When Subsequent Columns Have Images

I’ve come across a problem with Windows list controls (I am specifically using MFC, but it looks like it applies to all list controls in the Windows common controls library).
In my specific case, I want to create a list control that has two or more columns. The first column (0) is text-only and is used to allow the user to jump to entries by typing the text in that row. Column two (or three, or four, or whatever) has an image (or an image and text; either way).
This much is all well and good and can be done easily without problem, however the final list control then ends up having a space to the left of the text in column 0 (it may be on the right on an RTL system). This spacer appears to be reserved for an image and I cannot figure out a way to prevent it. (Arranging the specific order of the columns did not change anything.)
Looking around, I found some other people complaining of the same thing, specifically this thread which leads to this thread. The proposed solution does not work because as was stated, simply shrinking the width of column zero merely cuts off the text rather than the image spacer (plus, you then have to prevent and/or process any changes to column widths that the user tries to make).
Does anyone have any ideas of how to fix this bug short of writing a list control from scratch or using one of the too-fancy grid controls on CodeProject/CodeGuru/etc.?
Thanks a lot.
Did you try to change the iIndent member of the LVITEM struct? MSDN says this:
iIndent Version 4.70. Number of image widths to indent the item. A
single indentation equals the width of
an item image. Therefore, the value 1
indents the item by the width of one
image, the value 2 indents by two
images, and so on. Note that this
field is supported only for items.
Attempting to set subitem indentation
will cause the calling function to
fail.
Column 0 is special in a ListView. As soon as you assign a small image list to the ListView, the control expects you to show an image in column 0, so it leaves space for it.
Solutions:
make column 0 zero-width, give it the value you want the user to be able to type. Column 1 becomes your "first" text column. Columns 2+ are for your images. You need full row select style for this to work. Yes, you have to prevent the user from resizing column 0. Yes, that is a pain.
make a column that does have an image to be column 0 and use LVM_SETCOLUMNORDERARRAY to rearrange the display order
owner draw the items.
give column 0 an icon (just to cover all bases)

Expression Blend: Insert a row into a grid at design time

Ok, so I have a grid with lots of controls. And oops, I missed something and need to move everything down one row...
type type type
My mistake, I needed two rows...
type type type
Ok, this really sucks. So, how do I insert a row in a way that will move everything down.
Not sure which version of Blend you are on, but in version 4 I can click to the left of the grid to divide a row into two. This has three effects:
creates a new row in the Grid.RowDefinitions section
adds 1 to the Grid.Row attributes of all rows beneath your division (moves them all down a row)
adds 1 to the Grid.RowSpan attribute of all controls in the row you have divided
You can now manually change the the RowSpans back to their original value and voila - you have a blank row.

Resources