Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alisam - 28 Oct 2007 04:23 GMT
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
Graham Mayor - 28 Oct 2007 07:38 GMT
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)
Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> 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,
[quoted text clipped - 27 lines]
>
> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.