mcghue
08-05-2010, 06:11 AM
Basically I have done a mail merge and have a list of different accounts that need to be saved individually. When I record the macro it saves the file as I entered it although I pressed ctrl V
I want this to change with each document but have not been able to find how to do this. I am a novice and I understand how it works but dont know how to set it up
Sub test()
'
' test Macro
' Macro recorded 05/08/2010 by 702788770
'
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.MoveDown Unit:=wdLine, Count:=22
Selection.MoveRight Unit:=wdCharacter, Count:=11
Selection.MoveDown Unit:=wdLine, Count:=7
Selection.MoveUp Unit:=wdLine, Count:=3
Selection.MoveRight Unit:=wdCharacter, Count:=15
Selection.MoveRight Unit:=wdCharacter, Count:=11, Extend:=wdExtend
Selection.Copy
ChangeFileOpenDirectory _
"C:\documents and settings\702788770\Desktop\Router\Process\ini files\New Folder\"
ActiveDocument.SaveAs FileName:= "1.txt", FileFormat:=
wdFormatText , LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=False, AllowSubstitutions:=False _
, LineEnding:=wdCRLF
ActiveWindow.Close
End Sub
I want this to change with each document but have not been able to find how to do this. I am a novice and I understand how it works but dont know how to set it up
Sub test()
'
' test Macro
' Macro recorded 05/08/2010 by 702788770
'
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.MoveDown Unit:=wdLine, Count:=22
Selection.MoveRight Unit:=wdCharacter, Count:=11
Selection.MoveDown Unit:=wdLine, Count:=7
Selection.MoveUp Unit:=wdLine, Count:=3
Selection.MoveRight Unit:=wdCharacter, Count:=15
Selection.MoveRight Unit:=wdCharacter, Count:=11, Extend:=wdExtend
Selection.Copy
ChangeFileOpenDirectory _
"C:\documents and settings\702788770\Desktop\Router\Process\ini files\New Folder\"
ActiveDocument.SaveAs FileName:= "1.txt", FileFormat:=
wdFormatText , LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=False, AllowSubstitutions:=False _
, LineEnding:=wdCRLF
ActiveWindow.Close
End Sub