Save As Feature Not Supported RRS feed

  • Question

  • Hello all, 

    I am using Office Word 2010 with Visual Studio 2008. 

    I have created few Add-ins which customize my WORD documents which are opened from my application. 

    Now, when I have any document which is not opened from my Application, I need to disable these addins. This works fine untill I know that which document I am opening. 

    But the same fails when I use 'SAVE AS' feature. 'Save As' automatically creates a new document and does not fire any event, so that I can capture that event and do the necessary Ops. What if user selects Cancel ? I am using Microsoft.Office.Tools.Word for my Word Documents.

    Please help me if anyone have already faced this situation, either in Word/Excel and know the solution.



    M Sharma, TCS, India
    Friday, April 8, 2011 6:55 PM


  • Hi Mukta,


    If you have a VSTO add-in this application procedure is available.


    Private Sub Application_DocumentBeforeSave(ByVal Doc As Microsoft.Office.Interop.Word.Document, ByRef SaveAsUI As Boolean, ByRef Cancel As Boolean) Handles Application.DocumentBeforeSave


    If your add-in is global template based, Word has a FileSaveAs procedure you can modify.


    In your code if you are showing the user the save as dialog and you’re concerned about them canceling the save, you can do something like this.


    With wApp.Dialogs(wdDialogFileSaveAs)

                .Name = strPathName & strFileName

                If Not .Show = -1 Then

                    ‘Do Something

                End If

     End With


    Hope this helps

    Friday, April 8, 2011 7:47 PM