MSProject2003 : Use ViewApply for different languages

B

Bridou

Hi,

I'm trying to use the ViewApply() method in C# but in the examples I've seen
until now, we need to write the name of the screen in the current language.

So for example, as I'm french, I need to write :
ViewApply("&Tableau des ressources", Missing.Value, Missing.Value);
To access the resource sheet.

I'd like my tool being usable in english or other language, so my question
is : is there a "gobal" name to use instead of ""&Tableau des ressources" or
"Resource Sheet" ?

PS : The same question for the sheet : Gantt diagram which is in french
"Diagramme de &Gantt"

Thanks by advance.
Bridou
 
R

Rod Gill

There isn't a built in way unless you cycle through all views and test the
name. Use activeproject.Views(1).Name to look at each view. If the name has
Tableau in use French names, if it has Sheet use English and so on. You
probably only need to test once then set a flag to define which language is
in use then proceed from there.



--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 
B

Bridou

Thank you, I have search all sheet's name by doing :

for (int cpt = 1; cpt < 24; cpt++)
{
MessageBox.Show(cpt +"
"+activeproject..ViewList[cpt].ToString());
}

I have found that 1 is the "Gantt diagram" and 10 is "Resource sheet".
So now I use :
ViewApply(projetActif.ViewList[1].ToString(),
System.Reflection.Missing.Value, System.Reflection.Missing.Value);
And it's ok !

Now, I'm sure it will work with any language :)

Thank you again.
Bridou
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top