Hi,
I'd like to translate an export from a Dutch program into English. Luckily most text are just words instead of sentences. First I recorded my steps with 'find and replace' then I copied the code for all other words to be translated. Unfortunately after tens of words the code becomes messy. I've read the variable Collection would do the trick.
I tried to write this:
I think the problem lies within .Key but can't figure out what I'm doing wrong here. If I writeCode:Dim Coll As New Collection Coll.Add "Report", "Rapport" Coll.Add "Version", "Versie" 'Coll.Add many many other words For i = 1 To Coll.Count Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = Coll(i) .Replacement.Text = Coll(.Key) .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = True .MatchWholeWord = True End With Selection.Find.Execute Replace:=wdReplaceAll Next ithe popup translates it into English and shows "Version". Why isn't this working in the replacement text?Code:MsgBox Coll("Versie")
Thank you in advance,
Erik
A Collection doesn't have a Key property.
Look instead at the Dictionary object, which stores Key/Item pairs. Even the name sounds appropriate to the application ...
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks