Reply
 
Thread Tools Display Modes
  #1   Report Post  
kbgrunt
 
Posts: n/a
Default open Word from with a batch file

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.
  #2   Report Post  
Jay Freedman
 
Posts: n/a
Default

kbgrunt wrote:
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.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org


  #3   Report Post  
kbgrunt
 
Posts: n/a
Default

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.


"Jay Freedman" wrote:

kbgrunt wrote:
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.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



  #4   Report Post  
Jay Freedman
 
Posts: n/a
Default

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.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

kbgrunt wrote:
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.


"Jay Freedman" wrote:

kbgrunt wrote:
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.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



  #5   Report Post  
kbgrunt
 
Posts: n/a
Default

Jay, Thanks for the help. I think that will work for me.

"Jay Freedman" wrote:

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.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

kbgrunt wrote:
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.


"Jay Freedman" wrote:

kbgrunt wrote:
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.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Templates gman Page Layout 17 April 22nd 05 06:35 PM
Macros - Keyboard Commands Janet Microsoft Word Help 6 April 11th 05 05:28 AM
Non .doc files Tino New Users 12 March 9th 05 09:43 AM
Boiletplates from Word Perfect linda Microsoft Word Help 1 January 28th 05 05:37 PM
How to change merge forms from Word Perfect to Microsoft Word dollfindance Microsoft Word Help 2 December 30th 04 03:35 PM


All times are GMT +1. The time now is 08:56 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"