Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sample Code Create Word Macros Translation Localization Automation

31 views
Skip to first unread message

International Connections

unread,
Oct 7, 2003, 6:36:28 PM10/7/03
to
Sample code to create your own Word macros for translation and
localization.

This free code allows you to use Word macros to select text, open and
read the contents of text file or ASCII User Databases, search for
matches, displays a dialog box to give a chance to the user to choose
a translation, and then replace the selected text in the Word Document
with the translation.

You will find examples of Microsoft Word Macros driven by dialog
boxes.
(You can customize the code for your own translation or office
automation needs)

- Sample code to select all the sentences one after the others and use
them as searchstring.

- Sample code to select a sentence and use it as searchstring

- Sample code to grab any selected text from a Word file and to search
it into User Databases in text format

This template, with the macros, allows you (from within Microsoft
Word) to:

- Select one or multiple User Databases
- Specify search parameters (case sensitive/insensitive, UDBs' path,
search filter)
- Search one or multiple selected User Databases
- Grab each sentence in the document, and then use the current
sentence to search the selected plain text UDB(s)
- Select one of the proposed replacement string(s) (if found in the
UDB)
- Ad a new translation in the document and also into a plain text
format User Database (if not found in the UDB)
- Start translation where you left it during a previous session

This customizable code and the Word template will be a great asset for
your enterprise and will give you a good base to create your own
Translation application from within Microsoft Word 2000.

'Open ASCII User database
FileNumber = FreeFile ' Open DB
If Len(UDB2Search) Then
Open UDB2Search For Input As FileNumber
Do While (Not EOF(FileNumber))
'Loop through the DB file line by line
Line Input #FileNumber, UDB_line
'read each db line....

For the free DSCAN-UDM code go to:
http://members.tripod.com/Frenchtranslator/macros.html
(with visual graphics of macros running)

For more information & legacy since 1996 go to:
http://www.contactez.net/portfolio.html

Support my Southern Belle Holiday Gifts, Candles & Home Decoration
http://gift.contactez.net

More VB script free code, shareware, configuration management
information:
http://members.tripod.com/Frenchtranslator
Developing solutions that really help!

Gurley Community & Town History Alabama:
http://gurleyalabama.contactez.net

Example of code:

Sub GetSelectedText()
' Code to select highlighted text and use it as searchstring
Dim TextFromDocFile As String
Dim R
If Len(Selection) > 1 Then
' Get reference to the selected text.
SearchString = Selection ' get the text that is highlighted
If SearchString = "" Or SearchString = " " Then
' Check if the selected text is not only spaces.
R = MsgBox("Search String Not Valid (Empty).",
vbInformation, "DSCAN-UDM")
Exit Sub
End If
Else
R = MsgBox("Select text in document.", vbInformation,
"DSCAN-UDM")
Exit Sub
End If
'Optional - Check if the user has selected at at least one UDB
If NombredUDBSelected < 1 Then
UserFormSelectUDBs.Show ' if not ask to select UDB
Exit Sub
End If
' Call the sub to do the actual search
SearchUDB SearchString
End Sub

More code....
http://members.tripod.com/Frenchtranslator/macros.html

Message has been deleted
0 new messages