Language Independent Code (MS Project 2000)

N

NB

I have some VBA code in which I am renaming some columns and for that I

use Tableedit and TableApply. For English version of MSProject &Entry
works fine, But when user in japan tries to use it they get error
saying this "&Entry has been deleted".

I found in the VBA forum that we need to use Language specific literal
for "&Entry".

1. Can anyone suggest what is the proper way to code for this,
application I am working
on will be using Japanese,German and possibly other languages.
Users in Japan
have localized version of MSproject installed on their computers.


2. Do I need to change code OR is there is another way to have existing

code work. Is there any setting or language pack we can install on
japanese users pc to recognized English Text?

I need some advice on how to tackle this issue?

Any help is appreciated.

Thanks

NB
 
J

Jan De Messemaeker

Hi NB,

Here are some thoughts that may help

Via a workaround you can address views by a number:
globalviews(7).name for instance

This however implies that your views are arranged in the same order in
everybody's global, and I haven't taken the time yet to find out in what
order they exist in the collection.

If there weren't the problem with different alfabets, I would suggest to
rename all the interesting views such that everybody uses "the company
names" that you could address in your code; you would have to copy these
views into everybody's Global.mpt

Hope this helps,
 
J

John

NB said:
I have some VBA code in which I am renaming some columns and for that I

use Tableedit and TableApply. For English version of MSProject &Entry
works fine, But when user in japan tries to use it they get error
saying this "&Entry has been deleted".

I found in the VBA forum that we need to use Language specific literal
for "&Entry".

1. Can anyone suggest what is the proper way to code for this,
application I am working
on will be using Japanese,German and possibly other languages.
Users in Japan
have localized version of MSproject installed on their computers.


2. Do I need to change code OR is there is another way to have existing

code work. Is there any setting or language pack we can install on
japanese users pc to recognized English Text?

I need some advice on how to tackle this issue?

Any help is appreciated.

Thanks

NB

NB,
Here's another thought, a bit "off the wall" perhaps, but I used a
similar technique when I was writing code that had to be compatible with
Windows based desktop PCs and MacIntosh based desktop PCs - back when
Project would run on both.

It is quite likely that there is an identifier associated with each
Windows language pack. I don't know what or where it is, but you might
find something. Once the specific language is determined, it should be
possible to direct macro execution to code that is language appropriate.

John
Project MVP
 
J

Jan De Messemaeker

Hi John,

A few weeks ago there has been a thread on this and nobody seemed to find
the answer.
Now I tried some properties here and there and guess what:
vbe.vbprojects(1).buildfilename
gives the address of a global.dll and that one resides in a folder named by
the language code (1033 for English, 1043 for Dutch, etcetera)!
so with a string function the language of the installation can be found.

Come on nerdbeans, GO!
 
N

NB

Thanks guys for some great suggestions.

* I am not concern much of how to figure out the locale settings,
surely i will be able to figure it out by looking at the registry entry
or some other way.

* My concern is that in msproject (2000), Is there a way to access Task
properties by some ID instead of Name. In Japanese version it would
not say Text1 it would be something else, How do I can resolve this
issue? Is there a way to access these with some index value which is
common in all versions. What are my choices?

This is how it shows in object library :

Property Text10 As String
Member of MSProject.Task

Thanks Again

NB
 
J

John

NB said:
Thanks guys for some great suggestions.

* I am not concern much of how to figure out the locale settings,
surely i will be able to figure it out by looking at the registry entry
or some other way.

* My concern is that in msproject (2000), Is there a way to access Task
properties by some ID instead of Name. In Japanese version it would
not say Text1 it would be something else, How do I can resolve this
issue? Is there a way to access these with some index value which is
common in all versions. What are my choices?

This is how it shows in object library :

Property Text10 As String
Member of MSProject.Task

Thanks Again

NB

NB,
First, you're welcome.

As Jan mentioned previously, some objects in Project can be accessed by
index number rather than by name. In other cases where a long type
constant is required, (e.g. pjTaskCost), the actual constant value, (in
this case "188743685"), can be used. This information can be found by
looking at the object browser and selecting the class of interest and
then the member of that class.

With respect to other properties, such as referencing Text10, you may
need to employ a branch in the code that directs execution to the
appropriate language derivative. That is why I suggested first testing
for the language pack identifier (which Jan found). For example, you
could create an Open event macro that tests for the language and then
sets up a custom toolbar that activates the macros for that language. At
least that's how I did it way back when.

John
Project MVP
 
N

NB

Is there any help somewhere to find out what column names and find Test
filters such as
"equals" means in other languages?

I am looking for exactly what it says in japanese and german version?

Any help is apprecaited.

Thanks

NB
 
J

John

NB said:
Is there any help somewhere to find out what column names and find Test
filters such as
"equals" means in other languages?

I am looking for exactly what it says in japanese and german version?

Any help is apprecaited.

Thanks

NB

NB,
A similar question was asked about a week ago. I suggested a
cross-language dictionary. Jan suggested getting a copy of Project in
the actual language and comparing fields. Jan's approach is probably
better because dictionary translations won't always be exact. I assume
you have a counterpart or at least someone at the German or Japanese
companies that you can help you. If not, I think your best bet is to set
up some type of cooperative effort. The other language person doesn't
need to know VBA, you just need them to help you with translating.

Good luck.
John
Project MVP
 
N

NB

Thanks John for properly guiding me in the right direction. I created
Resource files in my .net application and also took Jan's advice on how
to look up for the locale of MSProject.

I am not done with all the changes in my app, But looks like that I am
on the right track.

Thank you Again.

NB
 
J

John

NB said:
Thanks John for properly guiding me in the right direction. I created
Resource files in my .net application and also took Jan's advice on how
to look up for the locale of MSProject.

I am not done with all the changes in my app, But looks like that I am
on the right track.

Thank you Again.

NB

NB,
You're welcome and good luck with your translation. Maybe you could
report back when you get something going. It might be of benefit to
others since this same issue has been brought up before.

John
 
N

NB

I was finally able to make my code work on Japanese version of
MSProject and with proper Resource files will work with any version.

Since my original code was written in VB.net, I modified it further to
make it work with also Language specific version of MSproject.

* First thing I created was a Resource file for Japanese Language and
defined each column name in Resource File as such :

<data name="Text23">
<value>テキスト 23</value>
</data>

* I created following enumeration which I used to check against locale
Private Enum LCID As Integer
en = 1033
ja = 1041
de = 1031
es = 3082
End Enum
* Here is the code which shows how to check's for Language specific
version of MSProject
and then load the proper Resource File :

'Thanks to Jan for providing following line of Code
strPath =
m_objProject.Application.VBE.VBProjects.Item(1).BuildFileName
If Not strPath = String.Empty Then
For Each enuLocaleID In [Enum].GetValues(GetType(LCID))
If strPath.IndexOf(enuLocaleID) > 0 Then
Dim objStream As Stream
m_resManager = New
ResourceManager("XYZNamespace.ColumnHeaders-" &
enuLocaleID.ToString(),
GetExecutingAssembly)
Exit For
End If
Next
End If

* Following will give some idea on how to and where you will need to
use value from Resource file :

m_objProjectApp.Sort(m_resManager.GetString("Text23"), True, , ,
False)

* Last use GetField and SetField method with constant params to either
set the value or retrieve the value from the column field :

strText=objProjectTask.GetField(PjField.pjTaskText29)
objProjectTask.SetField(PjField.pjTaskText29, strText)

By making above changes everthing worked out well in my case.

Thanks Again to Both Jan and John for guiding me in right direction.
Hope this helps other who are stuck in similar situation and need some
direction.


NB
 
J

Jan De Messemaeker

Hi NB,

You're welcome!

--
Jan De Messemaeker, Microsoft Project Most Valuable Professional
http://users.online.be/prom-ade/
For FAQs: http://www.mvps.org/project/faqs.htm
"NB" <[email protected]> schreef in bericht
I was finally able to make my code work on Japanese version of
MSProject and with proper Resource files will work with any version.

Since my original code was written in VB.net, I modified it further to
make it work with also Language specific version of MSproject.

* First thing I created was a Resource file for Japanese Language and
defined each column name in Resource File as such :

<data name="Text23">
<value>???? 23</value>
</data>

* I created following enumeration which I used to check against locale
Private Enum LCID As Integer
en = 1033
ja = 1041
de = 1031
es = 3082
End Enum
* Here is the code which shows how to check's for Language specific
version of MSProject
and then load the proper Resource File :

'Thanks to Jan for providing following line of Code
strPath =
m_objProject.Application.VBE.VBProjects.Item(1).BuildFileName
If Not strPath = String.Empty Then
For Each enuLocaleID In [Enum].GetValues(GetType(LCID))
If strPath.IndexOf(enuLocaleID) > 0 Then
Dim objStream As Stream
m_resManager = New
ResourceManager("XYZNamespace.ColumnHeaders-" &
enuLocaleID.ToString(),
GetExecutingAssembly)
Exit For
End If
Next
End If

* Following will give some idea on how to and where you will need to
use value from Resource file :

m_objProjectApp.Sort(m_resManager.GetString("Text23"), True, , ,
False)

* Last use GetField and SetField method with constant params to either
set the value or retrieve the value from the column field :

strText=objProjectTask.GetField(PjField.pjTaskText29)
objProjectTask.SetField(PjField.pjTaskText29, strText)

By making above changes everthing worked out well in my case.

Thanks Again to Both Jan and John for guiding me in right direction.
Hope this helps other who are stuck in similar situation and need some
direction.


NB
 

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