2016-12-14 53 views
0

我有一個表單有一個提交按鈕。當我在PC上執行它時,它可以正常工作,但是在沒有保存該文件的其他人的情況下,它會提示他們保存它。我想知道是否可以在發送之前添加一些能夠自動將其保存到文檔文件夾中的內容。自動保存表格,而不是生成提示手動保存

Private Sub CommandButton1_Click() 
    Dim OL    As Object 
    Dim EmailItem  As Object 
    Dim Doc    As Document 

    Application.ScreenUpdating = False 
    Set OL = CreateObject("Outlook.Application") 
    Set EmailItem = OL.CreateItem(olMailItem) 
    Set Doc = ActiveDocument 
    Doc.Save 

    With EmailItem 
     .Subject = "subject" 
     .Body = "BODY MESSAGE" 
     .To = "email here" 
     .Importance = olImportanceNormal 
     .Attachments.Add Doc.FullName 
     .Display 
    End With 

    Application.ScreenUpdating = True 

    Set Doc = Nothing 
    Set OL = Nothing 
    Set EmailItem = Nothing 
End Sub 

回答

0

我不知道我是否真的有你的問題。你不想要這個提示?

Set Doc = ActiveDocument 
Doc.Save 

保存文檔。如果您不想保存它,請刪除這些行。

+0

正確,我想我解決了我自己的問題。這個文件將在網絡上,所以我相信當他們點擊提交按鈕時,它不會提示他們保存,因爲它已經存在了。 –

+0

其實我有另一個問題,我需要將文檔保存在一個特定的位置。現在它保存在舊文檔中,我需要保存到特定位置才能通過電子郵件發送。 –