Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB creates Table in PowerPoint, but can't auto-format column size!

Status
Not open for further replies.

psykoProgrammer

Programmer
Dec 15, 2004
16
CA
I have a VB6 front end that transfers data back and forth from an Access db. Some of the functionality of the application is to provide users with reports. I can instantiate and populate data to both MS Word and PowerPoint, but on one such report i'm having trouble. This is where i need a guru like you!

In word you can auto-format a table no sweat, in PowerPoint i haven't been able to figure it out. Let me explain...

Table is created with n columns and rows, i write data to each cell. The data (these are large numbers if it matters), wraps to the next line. Looks like garbage, so i disabled word-wrap in the cells. Nice. Thought it all worked fine then. I was wrong.

The trouble is this, if the number is really long, it appears as if it is going into the preceding cell! I know a user can double click the column bar after the slideshow has been completed (but that defeats the entire automation purpose!), and it will auto-fit, so i tried to record a macro and did just that. The macro has no source in it!
So, i can't find my help that way, and haven't been able to figure out how to auto-format the cells.

Can anyone help? Thanks in advance!
 
Hi,

try using .AutoFit on the columns collection

Skip,
[sub]
[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue][/sub]
 
hmmm, i'm afraid i don't fully understand how i would do that :(

I have tried:

oPPPress.Slides(lSlideCtr).Shapes(n).TextFrame.AutoSize = ppAutoSizeShapeToFitText

And that obviously didn't work, and i've tried to make adjustments using:

oPPPress.Slides(lSlideCtr).Shapes(n).Table.Cell(n,m)...

and everything under the sun with those objects. (I have obviously removed my With statements just to provide a clear picture of what i'm doing).

The .Shapes(n).Table.Columns...appears to have a few properties and procedures (Add, Application, Count, Item, Parent), but which of these will lead me to the columns reference (if any) you are refering to?

Thanks so far...it sounds like it is possible to do (why can't i figure out a way to store a macro against it i wonder?)...and that you know how. I just need to delve a little more into your skills :)
 


sorry,

i just took a shot-in-the-dark that PP tables might be similar to Excel Columns. No such luck! I am no PP guru.

I was just poking around looking at the objects in PP. I can't even find where a text property is defined in a Table object. I'd be hunting -- trial and error -- using the Object Browser and Watch Window.


Skip,
[sub]
[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue][/sub]
 
Thanks for your time and effort Skip. I appreciate you even willing to give it a go ;)

As it turns out, i still can't find any reference in any technical papers regarding PowerPoint on how to do this, but i'm no longer certain it really matters. You see, if every column were to contain these obnoxious values the table coulnt't display them all properly anyway (there's only so much space on the slide for this table!). So, even if it were to work (and i'm not certain it can be done) it would look nasty.

As it stands, the users will have to give it a look over after the slideshow is generated, and the best i could do was turn wordwrap of, and hard code the width of each column to the best they can offer.

Again, thanks for your efforts!

Oh, if someone does know how to do this, please feel free to leave a reply. I've spent so much time with it i really am curious as to if it can be done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top