Hi,
Here's the situation :
(- Win 2k
- VB6
- MS Word 2k SP3)
My vb6 app has to produce reports about vehicles.
To do this, it loops x times through a procedure that should insert each vehicle's 'paragraph'.
Maybe 'Paragraph' is not the right word : I mean all data related to ONE vehicle.
I use a template to know how to diplay the data.
First problem :
- if my procedure has to loop about 70 times (70 vehicles), Word uses all my pc's memory and CPU, causing my app to run slower and slower (first 3 vehicles take 1 second to be inserted and around 50th vehicle, it takes 5 seconds for only one !)
So I tried to use a 'temp' doc to write vehicles data AT ONCE then select the whole content of the temp file and paste it in the 'real' doc.
i.e :
-----
open 'real' file
open 'temp' file
while not vehicle.EOF
write vehicle.data in 'temp'
copy 'temp' content to 'real'
clear 'temp' content
Next vehicle
wend
save 'real'
delete 'temp'
Time is much better for long files BUT
Now the problem is that ONE vehicle's data is written line per line... and those lines can be very different.
When I Paste from 'temp' to 'real', EACH LINE APPEARS WITH THE FORMAT OF THE FIRST ONE !
Globally, my question would be :
'How to Copy and Paste from one Word file to another EXACTLY LIKE IT IS ?"
I tried the clipboard.copyformat and .pasteformat commands but they always fail ('no format to copy' or something like that)
Far from being an expert with VBA, I tried the Macro Recorder... bad luck : the code it produces doesn't change anything.
Thanks in advance : any idea welcome !
Lemox
Here's the situation :
(- Win 2k
- VB6
- MS Word 2k SP3)
My vb6 app has to produce reports about vehicles.
To do this, it loops x times through a procedure that should insert each vehicle's 'paragraph'.
Maybe 'Paragraph' is not the right word : I mean all data related to ONE vehicle.
I use a template to know how to diplay the data.
First problem :
- if my procedure has to loop about 70 times (70 vehicles), Word uses all my pc's memory and CPU, causing my app to run slower and slower (first 3 vehicles take 1 second to be inserted and around 50th vehicle, it takes 5 seconds for only one !)
So I tried to use a 'temp' doc to write vehicles data AT ONCE then select the whole content of the temp file and paste it in the 'real' doc.
i.e :
-----
open 'real' file
open 'temp' file
while not vehicle.EOF
write vehicle.data in 'temp'
copy 'temp' content to 'real'
clear 'temp' content
Next vehicle
wend
save 'real'
delete 'temp'
Time is much better for long files BUT
Now the problem is that ONE vehicle's data is written line per line... and those lines can be very different.
When I Paste from 'temp' to 'real', EACH LINE APPEARS WITH THE FORMAT OF THE FIRST ONE !
Globally, my question would be :
'How to Copy and Paste from one Word file to another EXACTLY LIKE IT IS ?"
I tried the clipboard.copyformat and .pasteformat commands but they always fail ('no format to copy' or something like that)
Far from being an expert with VBA, I tried the Macro Recorder... bad luck : the code it produces doesn't change anything.
Thanks in advance : any idea welcome !
Lemox