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

ahmadwadan.com  Identity Verified
Kuwait
Local time: 13:52
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: 07:52
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: 12:52
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: 13:52
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







PDF Translation - the Easy Way
TransPDF converts your PDFs to XLIFF ready for professional translation.

TransPDF converts your PDFs to XLIFF ready for professional translation. It also puts your translations back into the PDF to make new PDFs. Quicker and more accurate than hand-editing PDF. Includes free use of Infix PDF Editor with your translated PDFs.

More info »
CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use SDL Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

More info »



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