Hi All

Finally I have recorded the following macro code:


Sub reports()
'
' reports Macro
'
'
    With ActiveDocument.MailMerge
        .Destination = wdSendToNewDocument
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
            .LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord
        End With
        .Execute Pause:=False
    End With
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.Copy
    ActiveDocument.SaveAs2 FileName:="PAK000366 - USA.docx", FileFormat:= _
        wdFormatXMLDocument, LockComments:=False, Password:="",
AddToRecentFiles _
        :=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
        :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False, CompatibilityMode:=11
    Windows("Progress Reports 2010    10 JUN 10.dotm [Compatibility Mode]").
_
        Activate
End Sub

The problem i am facing is only that:

every time the file is saved with the same name and not for what the copy
function is performed.

Please help me debug the problem.

Thanks in anticipation of quick response.

AZHAR RAI
Skype: azhar.rai


On Fri, Jun 4, 2010 at 16:52, Azhar Rai <azhar....@gmail.com> wrote:

> Hello Gurus
>
> I am afraid I did not receive response from anyone.
>
> AZHAR RAI
> Cell: +92-333-552-7731
> Skype: azhar.rai
>
>
> On Thu, Jun 3, 2010 at 10:03, Azhar Rai <azhar....@gmail.com> wrote:
>
>> Hi Gurus
>>
>> My work relates to prepare a large number of reports and I use mail merge
>> for all this process. I have to save each and every report separately. The
>> file name I need to use is also generated through mail merge at the very
>> first line of each report in MS Word document.
>>
>> What I need is when I apply the save as command on MS Word the new file
>> name is fetched from the first line of the report (a combination of Ref No,
>> Name, country or whatever).
>>
>> Please help me out in the issue.
>>
>> Thanks
>>
>> AZHAR RAI
>> Islamabad, Pakistan
>> +92-333-552-7731
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> Some important links for excel users:
>> 1. Follow us on TWITTER for tips tricks and links :
>> http://twitter.com/exceldailytip
>> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>> 3. Excel tutorials at http://www.excel-macros.blogspot.com
>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> <><><><><><><><><><><><><><><><><><><><><><>
>> HELP US GROW !!
>>
>> We reach over 7000 subscribers worldwide and receive many nice notes about
>> the learning and support from the group.Let friends and co-workers know they
>> can subscribe to group at
>> http://groups.google.com/group/excel-macros/subscribe
>>
>
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to