Mobile menu

Macro for restoring source from .bak files
Thread poster: ahmadwadan.com

ahmadwadan.com  Identity Verified
Kuwait
Local time: 01:35
English to Arabic
+ ...
May 7, 2007

Dear colleagues,

I have created macro for restoring source text from .bak files however I still need the code like that stop macro when it reaches end of file (EOF). The line I added is (Loop Until EOF) but it sounds wrong (unfunctional). Any idea what is the code could be. I added the whole macro below:


Sub autorestoresource()

Do

Application.Run MacroName:="TemplateProject.tw4winOpenGet.Main"
Application.Run MacroName:="TemplateProject.tw4winRestoreSource.Main"

Loop Until EOF(1)

End Sub


Direct link Reply with quote
 

gianfranco  Identity Verified
Brazil
Local time: 19:35
Member (2001)
English to Italian
+ ...
I keep a copy of the working files before clean-up May 7, 2007

Dear Ahmad,

this is not a direct answer to your question, but if I understand correctly you intend to use this macro to recover the content of a document after performing a clean-up with Trados, in case the clean-up doesn't go well or similar emergencies.

If this is the case, I would say that it is probably much safer to keep, in a folder, a copy of the uncleaned file, untouched, and perform the clean-up in another folder, using a copy of the work file.
This way, the uncleaned version is always available and a recovery will not rely on the vagaries of a .bak file or a macro.

bye
Gianfranco





[Edited at 2007-05-07 15:54]


Direct link Reply with quote
 
xxxOlaf
Local time: 00:35
English to German
EOF is only for text files May 7, 2007

Hi Ahmad,

As far as I know, a line such as:

Loop Until EOF(1)

requires a previous file open statement. E.g.

Open "C:\Output.txt" for Output as #1

Without it, you'll get an error message. Therefore your code cannot work. I'm not that familiar with the Word object model, but I guess you'll have to use a For Each or a With statement with the appropriate collection.

A quick & dirty version is:

Code:

Sub RestoreSource()

Dim parCount As Paragraph

For Each parCount In ActiveDocument.Paragraphs
Application.Run MacroName:="tw4winOpenGet.Main"
Application.Run MacroName:="tw4winRestoreSource.Main"
Next

End Sub



However, this only worked with parts of a unclean test document. I guess you'd have to test for errors generated by the Trados macro to make this work.

Hope this helps,
Olaf


Direct link Reply with quote
 

ahmadwadan.com  Identity Verified
Kuwait
Local time: 01:35
English to Arabic
+ ...
TOPIC STARTER
It works May 7, 2007

Olaf wrote:

Code:

Sub RestoreSource()

Dim parCount As Paragraph

For Each parCount In ActiveDocument.Paragraphs
Application.Run MacroName:="tw4winOpenGet.Main"
Application.Run MacroName:="tw4winRestoreSource.Main"
Next

End Sub





Hi Olaf,

Thank you so much. The code you provided works excellently.

May Allah bless you


Direct link Reply with quote
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Macro for restoring source from .bak files

Advanced search


Translation news related to SDL Trados





SDL MultiTerm 2017
Guarantee a unified, consistent and high-quality translation with terminology software by the industry leaders.

SDL MultiTerm 2017 allows translators to create one central location to store and manage multilingual terminology, and with SDL MultiTerm Extract 2017 you can automatically create term lists from your existing documentation to save time.

More info »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

More info »



All of ProZ.com
  • All of ProZ.com
  • Term search
  • Jobs