Shyam Pillai said:
Rene Mouchot said:
Hello all,
I'd like to optimize a vba program that generate a powerpoint file with at
least 80 slides ( with one table per slide).
The process is : create new powerpoint file, [add new slide, fill the
slide
with data] *, save and close the powerpoint file.
Actually it take10-15 minutes to do the work, so i'd like to know if there
are general tricks to speed up a powerpoint file generation ?
Thanks,
Rene,
What Steve said and also lock the screen updates. Even better if you can run
the automation by keeping the application invisible.
Besides this, we need for code optimization you need to post some code.
Regards,
Shyam Pillai
http://skp.mvps.org/
Steven, Shyam,
Sorry for the high response time
)
In the script i do a lot of call to InsertAfter function, then i set font
properties.
I can't really paste a vb code snippet cause i use perl to automate
powerpoint, but i'll try to translate and then you could maybe see what are
the functions call that cause problem.
Please take cate that the following code could not be correct.
For example i create a table of fixed width in each slide and i write in the
rows by calling InsertAfter in a TextRange. I set then some font properties
:
Set oTextRange = pptShape.Table.cell(intRowIndex,
1).Shape.TextFrame.TextRange.InsertAfter("Some text)
oTextRange.Font.Bold = True
oTextRange.Font.Name = "Arial"
oTextRange.Font.Size = 10
Set oTextRange = pptShape.Table.cell(intRowIndex,
2).Shape.TextFrame.TextRange.InsertAfter("Some another text)
oTextRange.Font.Name = "Arial"
oTextRange.Font.Size = 10
oTextRange.Font.Underline = True
etc...
When a table is totally filled, i set the width with fixed size and i hide
some borders:
For a row :
' set table border of one cell
set row = oTable.Table.Rows.Item(1)
row.Cells.Borders.Item(1).Visible = -1 ' ppBorderTop
row.Cells.Borders.Item(2).Visible = 0 ' ppBorderLeft
row.Cells.Borders.Item(3).Visible = 0 ' ppBorderBottom
row.Cells.Borders.Item(4).Visible = 0 ' ppBorderRight
' set table width
oTable.Table.Columns.Item(1).Width = 150
oTable.Table.Columns.Item(2).Width = 130
oTable.Table.Columns.Item(3).Width = 35
oTable.Table.Columns.Item(4).Width = 80
oTable.Table.Columns.Item(5).Width = 80
oTable.Table.Columns.Item(6).Width = 80
oTable.Table.Columns.Item(7).Width = 80
oTable.Table.Columns.Item(8).Width = 80
I guess i could use another function instead of InsertAfter, cause it's
seems to cause the problem, maybe you have an idea ?
--