Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2015, 05:11 AM
eNGiNe eNGiNe is offline create .docx from command line? Windows 7 32bit create .docx from command line? Office 2010 64bit
Expert
create .docx from command line?
 
Join Date: Jan 2012
Location: Brussels [BE]
Posts: 746
eNGiNe is on a distinguished road
Default create .docx from command line?

I need to create around 150 .docx files, for use as placeholders in a document management system. What's the easiest way to achieve this? I already have a list of the filenames we will be using.

Last edited by Charles Kenyon; 02-26-2015 at 09:29 AM. Reason: Mark as solved
Reply With Quote
  #2  
Old 02-10-2015, 02:49 PM
macropod's Avatar
macropod macropod is offline create .docx from command line? Windows 7 64bit create .docx from command line? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Create one such document, then add a macro using a SaveAs loop to it, to save the 150 copies, using your list for the filenames. For example:
Code:
Sub ReplicateMe()
Dim i As Long, StrPath As String, ArrNames()
ArrNames = Array("Document 1", "Document 2", "Document 3", "Document 4", "Document 5", "Document 6", "Document 7")
With ActiveDocument
  StrPath = .Path & "\"
  For i = 0 To UBound(ArrNames)
    .SaveAs2 FileName:=StrPath & ArrNames(i) & ".docx", Fileformat:=wdFormatXMLDocument, AddToRecentFiles:=False
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-11-2015, 02:03 AM
eNGiNe eNGiNe is offline create .docx from command line? Windows 7 32bit create .docx from command line? Office 2010 64bit
Expert
create .docx from command line?
 
Join Date: Jan 2012
Location: Brussels [BE]
Posts: 746
eNGiNe is on a distinguished road
Default

thanks, Paul … I think I almost understand that chunk of code :-} now let's see how many mistakes I make trying to run it.
Reply With Quote
  #4  
Old 02-12-2015, 12:10 AM
eNGiNe eNGiNe is offline create .docx from command line? Windows 7 32bit create .docx from command line? Office 2010 64bit
Expert
create .docx from command line?
 
Join Date: Jan 2012
Location: Brussels [BE]
Posts: 746
eNGiNe is on a distinguished road
Default

Poised to give it a try … don't suppose I could read the list of documents from an external file instead of hard-coding it in the macro?
Reply With Quote
  #5  
Old 02-12-2015, 12:17 AM
macropod's Avatar
macropod macropod is offline create .docx from command line? Windows 7 64bit create .docx from command line? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Yes, that would be possible, but I'd need to know the file format before I could code for it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 02-26-2015, 01:30 AM
eNGiNe eNGiNe is offline create .docx from command line? Windows 7 32bit create .docx from command line? Office 2010 64bit
Expert
create .docx from command line?
 
Join Date: Jan 2012
Location: Brussels [BE]
Posts: 746
eNGiNe is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Yes, that would be possible, but I'd need to know the file format before I could code for it.
Sorry for the delay … but I have finally made the time to try out the original macro. Just the job! and I now think I'll be able to manage my tasks better if I stick to the original version with a few hardcoded names.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Unintended Solid Line in .docx jwoodbury Word 5 05-04-2018 07:06 PM
From the command line, how do I run a Word macro? jdockstader Word 7 02-04-2013 06:09 AM
create .docx from command line? Command line syntax for 2010 asearle Word 1 08-07-2012 05:42 AM
Command Line Argument xJediDadx Outlook 1 02-21-2011 03:47 PM
Command Line Switches Ringmaster Office 0 08-10-2010 06:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft