Project VBA and Japanese


  • I have a Project VBA macro that is now being used by a client in Japan. (Previously, all the clients worked in English.) My custom input screen is in English and works fine. When it triggers msodialogopen, the file select box appears. The target file name correctly appears in English, but all the text around it is in Japanese. When the client tries to select the file, the program fails.

    I suspect the problem is that the "OK" button is in Japanese, and the program can't process the response.

    If anyone has faced and overcome this sort of problem, I'd appreciate knowing how you did so. Failing that, please let me know of any alternative sources for such info.


    Jumat, 16 November 2018 03.58

Semua Balasan

  • RobVV,

    A while back I had a similar problem. I was responding to a user in Russia who had problems with some VBA and hyperlinks. The code worked fine for me (English) but did not work for him (Russian). What we eventually discovered is that string variables are dependent on the language version of the application. Sounds logical, but we didn't see it at first. One of the EditHyperlink Method arguments was for the "Gantt Chart" view. That just didn't work for him. Once it was changed to the Russian equivalent, it worked.

    You might want to review your code and anyplace that requires string input or output be correctly coded in the appropriate language. So for example, if your code is looking for or issuing an "OK" you should try the Japanese equivalent.

    Just a thought.


    Jumat, 16 November 2018 15.50
  • Thanks for the insight, John. I'll see if I can trap the Japanese "OK" and update the post accordingly.


    Jumat, 16 November 2018 16.35
  • RobVV,

    You're welcome and thanks for the feedback. Hope it works for you, and your Japanese client.


    Jumat, 16 November 2018 17.03
  • John, my customer changed the language setting on his copy of MS Office to English. The call to msoFileDialogOpen then displayed labels, drop-down values, and buttons in English. The name of the test file we are using is all English, and it automatically populated .

    Next, I trapped the flow from msoFileDialogOpen. A list of file names was presented, all of which were files from our testing, and all of which were in English. One of them was selected, and the Open button was pressed. I trapped the value of .SelectedItems(1) and found that it was empty.

    The problem appears to be that msoFileDialogOpen is not making the file name available for further processing.

    Any thoughts?


    Kamis, 22 November 2018 20.12
  • RobVV,

    I finally was able to take a look at the FileDialogOpen issue. This is what I found.

    First of all, I couldn't use the FileDialog Object with Project 2010, which is the version I have; it may work with Project 2016 and Office 2016. However I was able to use it with Excel 2010.

    I ran some test code and found that in order to use the selected value, it had to be "captured" before exiting the loop that read the File Object. I did it by writing the selected value to an Excel cell. At that point, I was able to read that cell and use it for whatever I needed.

    This is the code I used (copied from the VBA Help file with most comments deleted)

    Sub Main()
    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFilePicker)

    Dim vrtSelectedItem As Variant
    'Use a With...End With block to reference the FileDialog object.
    With fd
        If .Show = -1 Then
            For Each vrtSelectedItem In .SelectedItems
                MsgBox "The path is: " & vrtSelectedItem
                ActiveWorkbook.Worksheets(1).Range("A1").Value = CStr(vrtSelectedItem)
            Next vrtSelectedItem
        End If
    End With
    Set fd = Nothing

    End Sub

    Hope this helps.


    Selasa, 27 November 2018 16.41
  • Thanks, John. I'll modify my macro and ask my customer to run it. I'll update the post once I have results.


    Selasa, 27 November 2018 23.05
  • The process is taking a long time because my customer in Japan is a full-time scheduler. Running my tests is not at the top of his priority list.

    I just got feedback on a test I sent him before receiving your suggestion. I asked him to manually input the file path in an Input Box. I wanted to see if I would get a mix of Roman and Kanji characters and subsequently use the full file path to open the file.

    At this point, I can verify that macros successfully accept and display the mixed characters. So far, the open fails on a 1004, file not found. When I examined the input echo, I found that he might have missed the Kanji for "\" at one point in his input.

    Once that's sorted out, I'll ask him to run the macro with the change you suggested and update the item.


    Senin, 03 Desember 2018 17.03