open Word from with a batch file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a batch file to FTP a file from a unix box, then open WORD
with a template other than the default; I can do all but the special
template. What is the command structure? Do I need to put the full path to
the mytemplate.dot file? We will use this in Word2000 thru Word2003.

Thanks.
 
kbgrunt said:
I need to create a batch file to FTP a file from a unix box, then
open WORD with a template other than the default; I can do all but
the special template. What is the command structure? Do I need to
put the full path to the mytemplate.dot file? We will use this in
Word2000 thru Word2003.

Thanks.

See http://support.microsoft.com/?kbid=210565 regarding startup switches,
particularly the /t switch. That starts Word with a new document based on
the template named by the switch. As long as the template is stored in the
User Templates folder (specified by Tools > Options > File Locations), you
don't have to include the full path.

If you're trying to open the file that you just transferred with FTP but
with the special template, that can't be accomplished with a command line.
You'd need an AutoOpen macro to "attach" the special template to the
document. But before you go there, what's the purpose of the template? Maybe
there's another way to achieve that purpose.
 
Jay,

I'm pulling an ASCII text report file, 136 columns wide, from a unix system.
Would like to open in WORD with a font and size that would keep report from
wrapping and be ready to print, in portrait mode. Other option would be to
go directly to printer but I need to be able to set printer to 17 characters
per inch.
 
OK, for that you don't want a template at all. What you do need is a macro
in the normal.dot template of the machine where Word will do this:

Public Sub SetupReport()
Documents.Open "C:\docs\wide.txt"
ActiveDocument.PageSetup.Orientation = wdOrientLandscape
With ActiveDocument.Range
.Font.Name = "Courier New"
.Font.Size = 7
End With
End Sub

Replace the filename in the Open statement with the correct value.*

Then in the batch file, use the statement
winword /mSetupReport
to run Word and start the macro.

*If the filename changes with each run the batch file needs to write that
name to a known location -- either a file with a constant name, or a
registry entry -- and the macro needs to retrieve that name. There's no way
to pass parameters to macros on the command line.
 
Back
Top