Mark said:
Because the code needs to be non language dependant. so using strings does
not work in diff languages
Mark,
Ok, I understand what you are trying to do. There may be a way to use
the view constant directly but after a little searching I couldn't
figure it out. However, not to leave you hanging without any answer,
here is a scheme that is a little clunky but it will work.
Depending on how many languages you need to write code for, you could
use the following code to get the list of available views for each
language.
Sub ViewList()
Dim v As Variant
For Each v In ActiveProject.ViewList
Debug.Print v
Next v
End Sub
Once you have the list or lists, you can then set up a lookup table in
your code for each language. It shouldn't be to difficult to put some
code at the beginning of your procedure to detect which language version
it is being used with. Then use the ViewApply Method and pull the view
string name from the appropriate lookup table.
Sometimes you have to use an indirect method to get what you want. When
I first started writing VBA for Project I often had to resort to
indirect ways of getting what I needed simply because Project's Object
Model didn't have or make certain things available. Newer versions of
Project have added many new objects, but you know, those old VBA macros
with indirect methods still work with the newer versions of Project.
John
Project MVP