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 / November 2005

Tip: Looking for answers? Try searching our database.

saves normal document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruno Coelho - 11 Nov 2005 12:34 GMT
hi, i have this simple code that saves to a normal document from a template.

Sub AutoClose()

Dim Savepath As String
Dim DocumentName As String
Dim box As String

Savepath = "G:\Administrativos\Credenciais de Deslocação\Dr. Carlos
Pinto\Credenciais Guardadas\"
box = InputBox("Qual o nome que deseja guardar", "Guardar")
DocumentName = box + Format(Now, "YYYY-MM-DD")

ActiveDocument.SaveAs FileName:=Savepath + DocumentName

End Sub

When i click on the close button it saves correctly and save it in normal
document, know, my question is when i open the normal document and close it
it appears again th InpuBox and saves again.
In the template, how can i do in VBA when save eliminate the code VBA of the
normal document.
Thanks
Tony Jollans - 11 Nov 2005 13:20 GMT
The AutoClose runs (from the template) every time you Close the document.

If you want to keep the same template attached to the document, perhaps the
easiest way is to check if the document has a path ..

Sub AutoClose()

Dim Savepath As String
Dim DocumentName As String
Dim box As String

If Activedocument.path <> "" then Exit sub

Savepath = "etc. etc.:

--
Enjoy,
Tony

> hi, i have this simple code that saves to a normal document from a template.
>
[quoted text clipped - 19 lines]
> normal document.
> Thanks
Bruno Coelho - 11 Nov 2005 14:56 GMT
Hi,
It works well
Thanks a lot Tony

> The AutoClose runs (from the template) every time you Close the document.
>
[quoted text clipped - 41 lines]
> > normal document.
> > Thanks
 
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.