Using the SaveAs Method : ActiveInspector « Application « VBA / Excel / Access / Word






Using the SaveAs Method

 
Sub saveAs()
    If TypeName(ActiveInspector) = "Nothing" Then
        MsgBox "This macro cannot run because " & _
            "there is no active window.", vbOKOnly, "Macro Cannot Run"
        End
    Else
        If ActiveInspector.IsWordMail Then
            ActiveInspector.CurrentItem.SaveAs "c:\message.doc"
        Else
            ActiveInspector.CurrentItem.SaveAs "c:\message.rtf"
        End If
    End If
End Sub

 








Related examples in the same category

1.Working with the Active Inspector
2.Check that the TypeName function does not return Nothing when run on the ActiveInspector method of the Application object:
3.Using the Close Method