Prev: 3rd Call For Papers, 17th Annual Tcl/Tk Conference 2010
Next: what encoding is the encoding named "unicode"?
From: Matthias Meier on 20 Jul 2010 05:31 Hello, the following VBA-Macro works fine: ----- Sub Makro1() Documents.Add "Z:\x y.dotx" End Sub ----- But with tcom: ----- package require tcom set word [::tcom::ref createobject Word.Application] set docs [$word Documents] $docs Add "z:/x y.dotx" ----- i get the COM-Exception: ----- 0x800A141F Word was unable to read this document. It may be corrupt. Try one or more of the following: * Open and Repair the file. * Open the file with the Text Recovery converter. ----- $docs Open "z:/x y.dotx" $docs Open "z:/noblank.dotx" or $docs Add "z:/noblank.dotx" works fine. Where ist the Problem? tcom oder word? Any ideas? Used versions are tcl/tk 8.5.8 tkom 3.9 word office2007 Thanks for any help! Matthias
From: Harald Oehlmann on 21 Jul 2010 07:49 On 20 Jul., 11:31, Matthias Meier <Me...(a)FuH-E.de> wrote: > $docs Add "z:/x y.dotx" Did you try: $docs Add {z:\x y.dotx}
From: Matthias Meier on 22 Jul 2010 04:00 Harald Oehlmann schrieb: > Did you try: > $docs Add {z:\x y.dotx} Yes - same error message. Matthias
From: Bruce on 22 Jul 2010 19:45
Matthias Meier wrote: > Harald Oehlmann schrieb: > >> Did you try: >> $docs Add {z:\x y.dotx} > > Yes - same error message. > not surprising, both "" and {} are quoting chars for Tcl so the interp would have removed both and passed a single 'word' to the function, obviously something further along is doing some kind or reparsing. It may be a bug in tcom, or possibly just a limitation with the way the windows com stuff works. You could try dipping into the edge of quoting hell by trying to do a double layer of quoting $docs Add {"z:\x y.dotx"} in this case the tcl interp will include the " chars as part of the argument and is may protect the space downstream (and if you filename is actually in a variable, then the {} will prevent substitution so something like $docs Add "\"$filename\"" may be required... good luck, Bruce |