Re: Parse style names into alias segments?



If the code is supposed to work in an international environment (which might
just be some users having set the MUI version to some menu/help language
other than English), the task can become an absolute beast.
The delimiters in alias names can turn into semicolons then, built-in styles
will take on the localized names, "Char" styles can be "Zchn" or "Car"
styles or whatever, ...
And you get a mix of all those names, depending on who edited the document
at some time in the past.

I've had cases where I wasn't able to access some styles by their name at
all. With all that renaming going on behind the scenes, it turned out
impossible to find (or guess) a name that works.

:-/ Klaus





"Bear" wrote:
Jonathan:

Thanks indeed. I had actually already hit on that as an emergency
workaround
method, but wondered if it was "good coding" or not.

I like the idea of incorporating the comma delimiters in the comparison.

Bear



"Jonathan West" wrote:

Hi Bear,

This might do the needful

If Instr(objPara.Style & ",", ",LN,") > 0 Then ...

This works on the basis that somewhere within your new style name with
all
the
aliases is your original vale. You need to ensure that you aren't
matching a
part of another alias of a different style, hence the need to add a
terminating comma to the alias list, and match for the style name with
opening and closing commas added.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

"Bear" <Bear@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:276D8026-373C-4C8F-9EA1-E1F82C136D10@xxxxxxxxxxxxxxxx
I use a lot of this:

if objPara.Style = "LN" then...

But now I'm asked to add aliases to my standard set of styles. This
will
break a lot of my code.

My first thought is to build a common function that will parse out each
segment of the style name, then evaluate each segment (Select Case),
and
pass
back the appropriate segment.

Does anyone have any code they'd like to share? I've explored Array,
but
aliases aren't formatted that way.

Or is there a way to test a style that avoids this problem?

Bear




.



Relevant Pages

  • Re: Word looks for another server on the network
    ... Pictures alias removed the AFP Connection Status dialog. ... If Word is interested in obtaining a resource, ... In the dialog that comes up after the request fails. ... I did not delete any aliases, ...
    (microsoft.public.mac.office.word)
  • Re: (quickie) (Aliasing) Possible to get this to work in strict?
    ... Here it just copies the memory address. ... an alias remains an alias. ... the reference-count has gone up to 2. ... Aliases are a lot like hard links on Unices. ...
    (comp.lang.perl.misc)
  • Re: Migrating from one server to another
    ... - where one of the aliases seems to become the ... unconfigure that alias to move it somewhere, ... for actually configuring stuff on the servers themselves.) ... We do not have them in the ODM. ...
    (AIX-L)
  • Re: (history of) BACKUP/ALIAS
    ... >> copied, not as files, but as aliases. ... What happens is that the data for alias files are ignored. ... In a restore operation, ... BACKUP/IMAGE then restores all the files, ...
    (comp.os.vms)
  • Re: JFs Cowardice
    ... >I've never used an alias, I post under my real name on this group. ... regulars there who used to support him are now sick of him. ... Some of JF's colorful posting aliases: ...
    (sci.space.shuttle)