P
Peter Karlström
Hi
I have developed a fairly large COM Addin for Word/Excel which helps my
customer to design and format their documents and spreadsheets.
The installation is +200 clients and we have a handfull (about 5) of them
experiencing performance problems.
We have made som logging adjustments to the code to be able to time the
different steps and to narrow the problem.
There are two seperate occasions with similar code that takes a lot of time
on these problem clients but executes as lightning on the rest. We have
checked the PC's CPU and RAM but that isn't the issue. Some has more memory
and faster CPU's then non-problem clients. It is not a Profile issue(central
profiles), since the problem disappears if the user logs on to a different PC.
The code involves pasting of AutoTextEntries from a loaded template into a
range in the documents header.
The code below takes approximately 17 seconds to execute. How is that
possible?
Code explanations:
MallDoc = a document which is loaded from a template with AutoTextEntries.
actDoc = the document which is beeing worked with.
Standard1 = the name of the AutoTextEntry. It contains a table with
bookmarks. The table is in 6 columns and 4 rows, but some of them are merged.
Before this step in the code the header is completely emptied.
+++++ code start
Set rngHeaderFirstPage =
wrdApp.Windows(actDoc).Document.Sections(1).Headers(wdHeaderFooterFirstPage).Range
wrdApp.Windows(Malldoc).Document.AttachedTemplate.AutoTextEntries("Standard1").Insert Where:=rngHeaderFirstPage
rngHeaderFirstPage.Tables(1).PreferredWidthType = wdPreferredWidthAuto
rngHeaderFirstPage.Tables(1).PreferredWidth = 0
rngHeaderFirstPage.Tables(1).Rows.SetLeftIndent -45, wdAdjustNone
rngHeaderFirstPage.WholeStory
rngHeaderFirstPage.ParagraphFormat.SpaceAfter = 0
rngHeaderFirstPage.ParagraphFormat.SpaceAfterAuto = False
rngHeaderFirstPage.Font.Name = "Times New Roman"
+++++ code end
Any suggestion or hint to how we can solve this is much appreciated.
Thanks in advance
I have developed a fairly large COM Addin for Word/Excel which helps my
customer to design and format their documents and spreadsheets.
The installation is +200 clients and we have a handfull (about 5) of them
experiencing performance problems.
We have made som logging adjustments to the code to be able to time the
different steps and to narrow the problem.
There are two seperate occasions with similar code that takes a lot of time
on these problem clients but executes as lightning on the rest. We have
checked the PC's CPU and RAM but that isn't the issue. Some has more memory
and faster CPU's then non-problem clients. It is not a Profile issue(central
profiles), since the problem disappears if the user logs on to a different PC.
The code involves pasting of AutoTextEntries from a loaded template into a
range in the documents header.
The code below takes approximately 17 seconds to execute. How is that
possible?
Code explanations:
MallDoc = a document which is loaded from a template with AutoTextEntries.
actDoc = the document which is beeing worked with.
Standard1 = the name of the AutoTextEntry. It contains a table with
bookmarks. The table is in 6 columns and 4 rows, but some of them are merged.
Before this step in the code the header is completely emptied.
+++++ code start
Set rngHeaderFirstPage =
wrdApp.Windows(actDoc).Document.Sections(1).Headers(wdHeaderFooterFirstPage).Range
wrdApp.Windows(Malldoc).Document.AttachedTemplate.AutoTextEntries("Standard1").Insert Where:=rngHeaderFirstPage
rngHeaderFirstPage.Tables(1).PreferredWidthType = wdPreferredWidthAuto
rngHeaderFirstPage.Tables(1).PreferredWidth = 0
rngHeaderFirstPage.Tables(1).Rows.SetLeftIndent -45, wdAdjustNone
rngHeaderFirstPage.WholeStory
rngHeaderFirstPage.ParagraphFormat.SpaceAfter = 0
rngHeaderFirstPage.ParagraphFormat.SpaceAfterAuto = False
rngHeaderFirstPage.Font.Name = "Times New Roman"
+++++ code end
Any suggestion or hint to how we can solve this is much appreciated.
Thanks in advance