Hi!
I am trying to write a macro which will use data in an excel file to detect the language of a word file. Basically, I have a word file named p18273602_1046_1_.doc, where 1046 is a language code. This changes depending on the language (i.e. p18273602_7_1_.doc).
In an Excel file, I have a language map where each language code is matched with a language. Below is an example of how the excel file is set up with the language in column A and the language code in column B.
AR 1
BR 1046
DE 7
SP 10
CS 4
What I want to do is open a message box with the language based on the language code. So for the file p18273602_1046_1_.doc, I want the macro to detect the 1046 language code and then show a message box that says something to the effect of "The language is: BR"
So far, I have written some code to isolate the language code in the file name:
myDocName = ActiveDocument.Name
posFromL = InStr(myDocName, "_")
posFromR = InStr(posFromL + 1, myDocName, "_")
langCodeDigits = (posFromR - posFromL) - 1
myDocStartName = Left(myDocName, posFromR - 1)
langCode = Right(myDocStartName, langCodeDigits)
How I would call the data in the Excel file, search for the language code in the excel file, and get the corresponding language?
I am trying to write a macro which will use data in an excel file to detect the language of a word file. Basically, I have a word file named p18273602_1046_1_.doc, where 1046 is a language code. This changes depending on the language (i.e. p18273602_7_1_.doc).
In an Excel file, I have a language map where each language code is matched with a language. Below is an example of how the excel file is set up with the language in column A and the language code in column B.
AR 1
BR 1046
DE 7
SP 10
CS 4
What I want to do is open a message box with the language based on the language code. So for the file p18273602_1046_1_.doc, I want the macro to detect the 1046 language code and then show a message box that says something to the effect of "The language is: BR"
So far, I have written some code to isolate the language code in the file name:
myDocName = ActiveDocument.Name
posFromL = InStr(myDocName, "_")
posFromR = InStr(posFromL + 1, myDocName, "_")
langCodeDigits = (posFromR - posFromL) - 1
myDocStartName = Left(myDocName, posFromR - 1)
langCode = Right(myDocStartName, langCodeDigits)
How I would call the data in the Excel file, search for the language code in the excel file, and get the corresponding language?