I'm writing a series of macros in VBA for Word. I need to set aside some
text so that a subsequent macro can look at it. I want to store it in a
custom document property, but msoPropertyTypeString is limited to 255
characters, and the text I want to store is sometimes longer than that. Is
there any other custom property type that I can use, or any other way that I
can store a bit of text outside of a running macro?

Thanks for your help.

Martin

Re: msoPropertyTypeString too short by Klaus

Klaus
Mon May 09 18:23:17 CDT 2005

Hi Martin,

Depends on what you want to do.

If you need the string variable again running the same macro at a later =
time, you could define it as Static.
Or if you want it available in all macros (until you quit Word), you =
could define it as Public at the top of the module.

If you want the string saved along with the doc (or template), you can =
use document variables (up to 64 kB in length):
ActiveDocument.Variables.Add Name:=3D"SomeName", Value:=3D"SomeString"

Or you might use some external (Unicode) text file to store strings.

Greetings,
Klaus



"Martin" <martin@patenttranslations.com> wrote:
> I'm writing a series of macros in VBA for Word. I need to set aside =
some
> text so that a subsequent macro can look at it. I want to store it in =
a
> custom document property, but msoPropertyTypeString is limited to 255
> characters, and the text I want to store is sometimes longer than =
that. Is
> there any other custom property type that I can use, or any other way =
that I
> can store a bit of text outside of a running macro?
>=20
> Thanks for your help.
>=20
> Martin
>=20
>

Re: msoPropertyTypeString too short by Martin

Martin
Mon May 09 18:53:52 CDT 2005

Thank you, Klaus! That is definitely among the very best answers that I have
ever received to any question. I used ActiveDocument.Variables and it worked
perfectly on the first try. I can see that defining it as Public would be
more elegant, and merging to two macros and then using a Static would be
even more elegant, but I will have to learn a little about those things
first. In the mean time, my macro works, thanks you your help!

Martin

"Klaus Linke" <info@fotosatz-kaufmann.de> wrote in message
news:el#vG4OVFHA.1200@TK2MSFTNGP14.phx.gbl...
Hi Martin,

Depends on what you want to do.

If you need the string variable again running the same macro at a later
time, you could define it as Static.
Or if you want it available in all macros (until you quit Word), you could
define it as Public at the top of the module.

If you want the string saved along with the doc (or template), you can use
document variables (up to 64 kB in length):
ActiveDocument.Variables.Add Name:="SomeName", Value:="SomeString"

Or you might use some external (Unicode) text file to store strings.

Greetings,
Klaus



"Martin" <martin@patenttranslations.com> wrote:
> I'm writing a series of macros in VBA for Word. I need to set aside some
> text so that a subsequent macro can look at it. I want to store it in a
> custom document property, but msoPropertyTypeString is limited to 255
> characters, and the text I want to store is sometimes longer than that. Is
> there any other custom property type that I can use, or any other way that
I
> can store a bit of text outside of a running macro?
>
> Thanks for your help.
>
> Martin
>
>



Re: msoPropertyTypeString too short by Klaus

Klaus
Mon May 09 19:46:17 CDT 2005

Glad it worked well! I don't have much experience with document =
variables.
One nice thing about them is that you can insert them in the document =
using DocVariable fields:
{ DocVariable SomeName }

Greetings,
Klaus


"Martin" <martin@patenttranslations.com> wrote:
> Thank you, Klaus! That is definitely among the very best answers that=20
> I have ever received to any question. I used ActiveDocument.Variables=20
> and it worked perfectly on the first try. I can see that defining it =
as Public=20
> would be more elegant, and merging to two macros and then using a=20
> Static would be even more elegant, but I will have to learn a little =
about=20
> those things first. In the mean time, my macro works, thanks you your =
help!
>=20
> Martin
>=20
> "Klaus Linke" <info@fotosatz-kaufmann.de> wrote in message
> news:el#vG4OVFHA.1200@TK2MSFTNGP14.phx.gbl...
> Hi Martin,
>=20
> Depends on what you want to do.
>=20
> If you need the string variable again running the same macro at a =
later
> time, you could define it as Static.
> Or if you want it available in all macros (until you quit Word), you =
could
> define it as Public at the top of the module.
>=20
> If you want the string saved along with the doc (or template), you can =
use
> document variables (up to 64 kB in length):
> ActiveDocument.Variables.Add Name:=3D"SomeName", Value:=3D"SomeString"
>=20
> Or you might use some external (Unicode) text file to store strings.
>=20
> Greetings,
> Klaus
>=20
>=20
>=20
> "Martin" <martin@patenttranslations.com> wrote:
> > I'm writing a series of macros in VBA for Word. I need to set aside =
some
> > text so that a subsequent macro can look at it. I want to store it =
in a
> > custom document property, but msoPropertyTypeString is limited to =
255
> > characters, and the text I want to store is sometimes longer than =
that. Is
> > there any other custom property type that I can use, or any other =
way that
> I
> > can store a bit of text outside of a running macro?
> >
> > Thanks for your help.
> >
> > Martin
> >
> >
>=20
>