PDA

View Full Version : Solved: Application Name



TonyJollans
10-12-2007, 03:22 AM
Just for a change I'm going to ask a question.

I'm running in Word VBA - is there any way I can get the string "Word" returned for sure without hard coding it. I want to do this so that I can have common code in Word and Excel to access registry keys with those names.

Application Name returns "Microsoft Word" (or in Excel - "Microsoft Excel"). I am currently stripping of the "Microsoft" bit but I have no idea if it's a good way to go.

fumei
10-12-2007, 01:12 PM
Details?

Is there an issue with stripping off "Microsoft "?

"is there any way I can get the string "Word" returned for sure without hard coding it."

Returned from where? From Word itself? I know of no value in Word VBA that will return just "Word", and only "Word".

TonyJollans
10-12-2007, 02:39 PM
Yes - returned from Word itself. There's nothing wrong with stripping "Microsoft " off the front and it's easy to code - except that I'm just guessing that that will always be correct.

I am trying to access registry keys ...Office\12.0\Word\File MRU - or ...Office\12.0\Excel\File MRU or ... and I'd like to be able to use the same code in each app to get the appropriate key for that app, so I'd prefer to avoid hard code.

I think what I'm doing is probably as good as it can be but just thought I'd ask :)

TonyJollans
10-12-2007, 11:43 PM
Actually I thought about this and, of course, none of the registry key name (or even its existence) is guaranteed so I'm happy with what I've got.

fumei
10-15-2007, 10:18 AM
"none of the registry key name (or even its existence) is guaranteed so I'm happy with what I've got."

:rotlaugh:

Aren't we all......