Re: Split Word doc into several files (continued)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




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


.



Relevant Pages

  • Re: Are these the best set of bitset macros in the world or what!?
    ... I also have a collection of bit manipulation macros, ... The purpose of the macro is to provide another ... An example would be processing ARINC 429 flight data in a generic ... \brief Define the integer type used to create a bitmask of zeros ...
    (comp.lang.c)
  • Re: PLEASE HELP ME ! PLEASE
    ... The '^' operator requires operands of an integer type. ... If you really are committed to the silly XOR trick, check the FAQ and the newsgroup archives to find out why you shouldn't be. ... Not that I think either of those solutions is any good but the original problem contained questions of the type "enter a single digit number". ... > Macro in main function. ...
    (comp.lang.c)
  • Re: Ada exception block does NOT work?
    ... > but that's true of Strings and whatnot, ... I'd call the integer type ... -- No overflows in any numerical operations, ... The memory required to keep bounds might be bigger than all ...
    (comp.lang.ada)
  • Re: Array indexing
    ... Geez you'd want a good programmer on the job so. ... int *xvals; ... Because on normal machines there simply isn't enough memory to overflow ... why the hell would you want to use a signed integer type when the ...
    (comp.lang.c)
  • Re: How many bits are 1 in a integer variable?
    ... The typedef, "BitsSetType", specifies the unsigned ... integer type which is to be used for processing. ... This macro should work with unsigned integer types ... typedef unsigned BitsSetType; ...
    (comp.lang.c)