Hi,

check this out

Sub CreateWordDocs()
    ' add a reference to the Word-library
    ' this is for creating number word Documents and renaming them with
file names mentioned in 'C' column
    ' this code doesn't write any content, it just creates word documents
and saves them

    Dim newapp As Word.Application
    Dim newDoc As Word.Document
    Dim xsht As Worksheet
    Dim filename As Range
    Dim xcell As Range
    Dim LastCell As Range
    Dim i As Integer

    Set xsht = ActiveWorkbook.Sheets("Sheet1")
    Set LastCell = xsht.Range("C65000").End(xlUp)

    If Not LastCell.Row > 1 Then Exit Sub 'condition to check whether
filename is entered or not

    Set filename = xsht.Range("C2:C" & LastCell.Row)

    Set newapp = CreateObject("word.application")
    newapp.Visible = True

    For Each xcell In filename

        Set newDoc = newapp.Documents.Add

        With newDoc
            .SaveAs ("D:\New Folder\" & xcell.Value & ".doc") 'instead of
"D;\New Folder", you can give your own path
            .Close
        End With
        Set newDoc = Nothing
    Next xcell

    newapp.Quit
    Set newDoc = Nothing
    Set newapp = Nothing

End Sub

------------------------------------------------------------------------------

Sub CreateNotePads()

    'this with create notepads without writing any content in them

    Dim fs As Object
    Dim a As Object
    Dim xsht As Worksheet
    Dim filename As Range
    Dim xcell As Range
    Dim LastCell As Range
    Dim i As Integer

    Set xsht = Sheets("Sheet1")
    Set LastCell = xsht.Range("C65000").End(xlUp)

    If Not LastCell.Row > 1 Then Exit Sub 'condition to check whether
filename is entered or not

    Set filename = xsht.Range("C2:C" & LastCell.Row)

    Set fs = CreateObject("scripting.filesystemobject")

    For Each xcell In filename

        Set a = fs.createtextfile("D:\New Folder\" & xcell.Value & ".txt",
True) 'give your own path

        Set a = Nothing
    Next xcell


End Sub


Regards
Kumar


On Tue, Mar 13, 2012 at 2:08 PM, Patil MG <mailpati...@gmail.com> wrote:

> Hi All
>
> can any one help me plzzzz......its very urgent,,,,,,,,,,,,,,,
>
>
> On Mon, Mar 12, 2012 at 12:52 PM, Patil MG <mailpati...@gmail.com> wrote:
>
>> Dear Experts,
>>
>> I have to create 'N' number of empty files of word and note pad files,
>> this word will long time to do can any one help to write a macro where in
>> which i can create empty word files or note pad files by running the macro,
>> my files will be listed in excel file (please refer the attached Excel
>> sheets
>>
>> --
>> Thank You
>> Patil MG
>>
>>
>>  --
>> FORUM RULES (986+ members already BANNED for violation)
>>
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>> will not get quick attention or may not be answered.
>>
>> 2) Don't post a question in the thread of another member.
>>
>> 3) Don't post questions regarding breaking or bypassing any security
>> measure.
>>
>> 4) Acknowledge the responses you receive, good or bad.
>>
>> 5) Cross-promotion of, or links to, forums competitive to this forum in
>> signatures are prohibited.
>>
>> NOTE : Don't ever post personal or confidential data in a workbook. Forum
>> owners and members are not responsible for any loss.
>>
>>
>> ------------------------------------------------------------------------------------------------------
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>
>
>
> --
> Thank You
> Patil MG
> 9663374848
>
> Life is Very Beautiful!!!
> ¨`•.•´¨)  Always
> `•.¸(¨`•.•´¨)  Keep
> (¨`•.•´¨)¸•´     Smiling!
>   `•.¸.•´.
>
>  --
> FORUM RULES (986+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
>
> ------------------------------------------------------------------------------------------------------
> To post to this group, send email to excel-macros@googlegroups.com
>

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to