|
-
Mar 8th, 2006, 07:50 AM
#1
Thread Starter
New Member
[RESOLVED] Close template if not doc not saved
I made a template in WORD
But what am trying to do now is that
When the template is open should be a wdDialogFileSaveAs should be started
But when the user clicks on cancel the template should be closed and not be used anymore
i thought of solving it like that
MsgBox "SAVE befor you start … "
activedocument.Saved = False
CommandBars.FindControl(ID:=3).Execute
If activedocument.Saved Then
' MsgBox "The document was saved."
' If MsgBox("you dont want to save the doc? ?", vbYesNo + vbQuestion, SAVING) = vbNo Then
' activedocument.Close
'
activedocument.Close
RecentFiles(1).Open
yesNo = yes
Else
MsgBox "somting "
But i always get Error or it doesn’t work good ..
Help .. any tips ?
-
Mar 8th, 2006, 12:19 PM
#2
Re: Close template if not doc not saved
Add the following code in a module in your template:
VB Code:
Sub AutoOpen()
Dim dlgSaveAs As Dialog
Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)
With dlgSaveAs
BeginSave:
If Not .Display = -1 Then
If MsgBox("you dont want to save the doc? ?", vbYesNo + vbQuestion) = vbNo Then
ActiveDocument.Close
Else
GoTo BeginSave
End If
Else
.Format = wdFormatDocument
.Execute
End If
End With
End Sub
-
Mar 8th, 2006, 02:34 PM
#3
Thread Starter
New Member
-
Mar 9th, 2006, 10:38 AM
#4
Re: Close template if not doc not saved
Please mark the thread "RESOLVED" if you got an answer to your questions.
Last edited by cssriraman; Mar 9th, 2006 at 11:07 AM.
CS
-
Mar 9th, 2006, 11:04 AM
#5
Thread Starter
New Member
Re: Close template if not doc not saved
-
Mar 9th, 2006, 11:06 AM
#6
Re: Close template if not doc not saved
 Originally Posted by String-0
how where what ??
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Mar 9th, 2006, 02:43 PM
#7
Thread Starter
New Member
Re: [RESOLVED] Close template if not doc not saved
ok sorry guys ;; i just did it ..
thx alot again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|