Macro saved my doc, how do I immediately open it again

A

alisam

This macro has been generously given to me by Doug Robbins MVP in this
discussion group and I have added to it. Instead of using the MsgBox, how do
I immediately get the macro to open the document (that it just saved)? The
reason I wish to do this is so that I can e-mail the word document using the
Send to Mail Recipient (as Attachment) button.

Sub Release_Client()

Dim Source As Document, Target As Document
Dim fname As String
Dim arange As Range
Dim amsg As String

Set Source = ActiveDocument
With Source
fname = "C:\Release Notes\Client\" & .FormFields("Client_Task").Result &
"_" & .FormFields("Client_Code").Result
Set arange = .Sections(11).Range
arange.End = .Sections(12).Range.End
End With
Set Target = Documents.Add
With Target
.Range.FormattedText = arange.FormattedText
.Range.Fields.Unlink
.SaveAs fname
.Close
amsg = "Client Release Notes have been saved in C:\Release Notes\Client\"
MsgBox amsg
End With

End Sub
 
G

Graham Mayor

Remove the line
..Close
which will keep the saved document open
Remove the line
MsgBox amsg
which will remove the message box (though I would leave it as confirmation
that it has been saved)
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top