Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a cell name as a word doc
I have a list of cells in an excel spreadsheet that I want to use to create
separate word documents from a generic word document. right now I'm copying the cell name switching to Word opening file Save as and pasting the name. It doesn't take long but I've got over a thousand names to save as. Is there any way in Excel or Word that I can automate this process? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a cell name as a word doc
Say we have three names in A1 thru C1:
Firstfl Secondfl Thirdfl First put a dummy name in D1. The enter and run this macro: Sub Macro1() Dim s As String Dim i As Integer For i = 1 To 4 s = Cells(i, 1).Value fname = "C:\" & s & ".txt" ActiveWorkbook.SaveAs Filename:= _ fname, FileFormat:= _ xlText, CreateBackup:=False Next x = Shell("cmd.exe /c rename C:\*.txt *.doc", 1) End Sub The For loop creates a set of .txt files and the Shell command renames them as .doc. You will have three .doc files as a result. You can increase from three to any number. The extra dummy entry in needed to insure the last real entry gets renamed. -- Gary''s Student....gsnu02012006 "LDBlanes" wrote: I have a list of cells in an excel spreadsheet that I want to use to create separate word documents from a generic word document. right now I'm copying the cell name switching to Word opening file Save as and pasting the name. It doesn't take long but I've got over a thousand names to save as. Is there any way in Excel or Word that I can automate this process? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a cell name as a word doc
Thanks it works like a charm.
"Gary''s Student" wrote: Say we have three names in A1 thru C1: Firstfl Secondfl Thirdfl First put a dummy name in D1. The enter and run this macro: Sub Macro1() Dim s As String Dim i As Integer For i = 1 To 4 s = Cells(i, 1).Value fname = "C:\" & s & ".txt" ActiveWorkbook.SaveAs Filename:= _ fname, FileFormat:= _ xlText, CreateBackup:=False Next x = Shell("cmd.exe /c rename C:\*.txt *.doc", 1) End Sub The For loop creates a set of .txt files and the Shell command renames them as .doc. You will have three .doc files as a result. You can increase from three to any number. The extra dummy entry in needed to insure the last real entry gets renamed. -- Gary''s Student....gsnu02012006 "LDBlanes" wrote: I have a list of cells in an excel spreadsheet that I want to use to create separate word documents from a generic word document. right now I'm copying the cell name switching to Word opening file Save as and pasting the name. It doesn't take long but I've got over a thousand names to save as. Is there any way in Excel or Word that I can automate this process? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a cell name as a word doc
You are very welcome
-- Gary''s Student "LDBlanes" wrote: Thanks it works like a charm. "Gary''s Student" wrote: Say we have three names in A1 thru C1: Firstfl Secondfl Thirdfl First put a dummy name in D1. The enter and run this macro: Sub Macro1() Dim s As String Dim i As Integer For i = 1 To 4 s = Cells(i, 1).Value fname = "C:\" & s & ".txt" ActiveWorkbook.SaveAs Filename:= _ fname, FileFormat:= _ xlText, CreateBackup:=False Next x = Shell("cmd.exe /c rename C:\*.txt *.doc", 1) End Sub The For loop creates a set of .txt files and the Shell command renames them as .doc. You will have three .doc files as a result. You can increase from three to any number. The extra dummy entry in needed to insure the last real entry gets renamed. -- Gary''s Student....gsnu02012006 "LDBlanes" wrote: I have a list of cells in an excel spreadsheet that I want to use to create separate word documents from a generic word document. right now I'm copying the cell name switching to Word opening file Save as and pasting the name. It doesn't take long but I've got over a thousand names to save as. Is there any way in Excel or Word that I can automate this process? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 Word Wrap Problem within cell | Excel Discussion (Misc queries) | |||
delete cell that doesn't contain a specific word | Excel Discussion (Misc queries) | |||
Number in cell convert in word | Excel Worksheet Functions | |||
Possible Lookup Table | Excel Worksheet Functions | |||
Can not see all of a pasted paragraph from Word in a cell. | Excel Discussion (Misc queries) |