Re: Split Word doc into several files (continued)
- From: "Jean-Guy Marcil" <Not.Interested@xxxxxxxxxxx>
- Date: Mon, 22 Jun 2009 17:53:09 -0400
Pesach Shelnitz was telling us:
Pesach Shelnitz nous racontait que :
Hi Jean-Guy,
Thank you for taking the time to look over my code and offer your
suggestions.
From the start, I tried simply copying the contents of the
FormattedText property instead of using the Copy and Paste methods,
but I was losing the formatting of the last paragraph.
This probably means that there was a problem with the manner in which you
were manipulating your ranges.
Now that my
macro is correctly splitting paragraphs at the page breaks where the
document should be split, I could use the preferable technique that
you suggested for files that don't need to be split at a page break
within a table. In such cases, even if I split the table at the page
break, the macro crashes when it tries to save the new file after
such a break.
Then you were doing something wrong?
:-P
With Copy and Paste I can presently generate the split
files even when splitting is done at a page break within a table. I
intend to continue working on this.
I don't understand why you say that the Integer type should be
replaced by Long in my macro. According to the MSDN documentation for
InStr (http://msdn.microsoft.com/en-us/library/8460tsh1.aspx ), the
return value of this function is an Integer, and Integer is still
listed as a data type for Visual Basic
Probably for backward compatibility.
(http://msdn.microsoft.com/en-us/library/47zceaw7(VS.100).aspx). I
thus don't see any reason not to use the Integer type for the return
value of InStr (k), integers from 1 to 10 (j), and the number of
files generated by my macro (i).
On the other hand, the MSDN documentation for the
PageSetup.FooterDistance property
(http://msdn.microsoft.com/en-us/library/bb210941.aspx) and other
properties of this object, states that each of these properties holds
a Single. Both a Single and an Integer are 32-bit numbers, but since
a Single supports a floating decimal point, I should use the Single
type for these properties. The Long data type offers no advantage
over the Integer type in this case because it uses more memory (8
bytes instead of 4) and does not support a floating decimal point.
Some time ago I read that the Integer, being so small, cannot correspond to
an actual memory address, so the compiler has to convert it so that it can
actually fit in the smallest physical unit that is available, which, I was
told, was a long.
So, if you have a lot of integer manipulation in a macro, it might slow
down a bit because the compiler has to convert the integers into Longs to
actually place them in the smallest physical memory unit available. However,
this was a while ago, and I may remember incorrectly.
So, since I read about this detail, I always use Long.
--
______________________________
Jean-Guy Marcil
Montreal, Canada
.
- References:
- Split Word doc into several files (continued)
- From: Pesach Shelnitz
- Re: Split Word doc into several files (continued)
- From: Jean-Guy Marcil
- Re: Split Word doc into several files (continued)
- From: Pesach Shelnitz
- Split Word doc into several files (continued)
- Prev by Date: Re: Error! Reference source not found.
- Next by Date: Re: Template - Save changes
- Previous by thread: Re: Split Word doc into several files (continued)
- Next by thread: Error! Reference source not found.
- Index(es):
Relevant Pages
|