2015-01-13 37 views
0

在此先感謝。 我一直在研究各種方法,允許將html代碼或.html文件導入到使用VBA的Outlook 2010電子郵件中,但對於我的沮喪,我注意到所有導入技巧似乎都導致所有包含HEAD被剝離出來。Outlook 2010 VBA腳本保留<head></head>部分.html導入

作爲一個例子,當使用相同的html CSS代碼Thunderbird它的工作完美無暇,發送時收件人似乎也獲得了樣式以及客戶端(Gmail,雅虎等)。 Thunderbird以HTML作爲簡單輸入來完成這項工作。那麼,爲什麼我試圖通過展望實現這一目標呢?簡單地說,客戶端要使用Outlook 2010.

我發現很難相信沒有一些漂亮的解決方法可以防止Outlook剝離此內容,然後發送保留HEAD內容的電子郵件,以便響應樣式正常工作。

這是我一直使用至今

VBA參考

  • Visual Basic應用程序
  • 的Microsoft Outlook 14.0對象庫
  • 的Microsoft Office 14.0對象庫
  • Microsoft Word中14.0對象庫
  • OLE自動化
  • 這是獲得有斑紋

    <head> 
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" /> 
    
    <style type="text/css"> 
    
    body{width:100%;margin:0px;padding:0px;background:#444444;text-align:center;} 
    html{width: 100%; } 
    img {border:0px;text-decoration:none;display:block; outline:none;} 
    a,a:hover{color:#ee7716;text-decoration:none;}.ReadMsgBody{width: 100%; background-color: #ffffff;}.ExternalClass{width: 100%; background-color: #ffffff;} 
    table {border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; } 
    .padtop10 {padding-top:10px;} 
    .main-bg{ background:#444444;} 
    .pads {padding:0px 15px 0px 15px;} 
    .mobdes{font-size:10px;} 
    @media only screen and (max-width:640px) 
    
    { 
        body{width:auto!important;} 
        .padtop10 {padding-top:0px;} 
        .main{width:100% !important;margin:0px; padding:0px;} 
        .two-column{width:100% !important;margin:0px; padding:0px;} 
        .mobileCenter{width: 100% !important; text-align: center!important;} 
        .two-left{width: 100% !important; text-align: center!important;} 
        .date{font:Bold 14px Arial, Helvetica, sans-serif; color:#ee7716;} 
        .mobdes{font-size:8px !important;} 
        .customobpad{padding-top:30px !important;} 
    
    } 
    
    @media only screen and (max-width:479px) 
    { 
        body{width:auto!important;} 
        .padtop10 {padding-top:15px;} 
        .main{width:100% !important;margin:0px; padding:0px;} 
        .two-column{width:100% !important;margin:0px; padding:0px;} 
        .mobileCenter{width: 100% !important; text-align: center!important;} 
        .two-left{width: 100% !important; text-align: center!important;} 
        .date{font:Bold 12px Arial, Helvetica, sans-serif; color:#ee7716;} 
        .mobilogo {height:49px; width:190px !important; padding-left:15px !important; margin-left:-15px;} 
        .pads {padding:0px 18px 0px 28px;} 
        .mobdes{font-size:8px !important;} 
        .customobpad{padding-top:30px !important;} 
    } 
    @media only screen and (max-width:800px) 
    and (orientation : landscape) { 
    body{width:auto!important;} 
        .padtop10 {padding-top:5px;} 
        .main{width:100% !important;margin:0px; padding:0px;} 
        .two-column{width:100% !important;margin:0px; padding:0px;} 
        .mobileCenter{width: 100% !important; text-align: center!important;} 
        .two-left{width: 100% !important; text-align: center!important;} 
        .date{font:Bold 12px Arial, Helvetica, sans-serif; color:#ee7716;} 
        .mobilogo {height:39px; width:172px; padding-left:15px !important; margin-left:-15px;} 
        .pads {padding:0px 18px 0px 28px;} 
        .mobdes{font-size:8px !important;} 
        .customobpad{padding-top:30px !important;} 
    } 
    
    
    
    </style> 
    
    </head> 
    

    VBA宏代碼FOR IMPORT

    Sub InsertHTMLClean2() 
    Dim insp As Inspector 
    Set insp = ActiveInspector 
    If insp.IsWordMail Then 
    Dim wordDoc As Word.Document 
    Set wordDoc = insp.WordEditor 
    Dim FileToOpen As String 
    FileToOpen = InputBox("filename?") 
    wordDoc.Application.Selection.InsertFile FileToOpen, , False, False, False 
    End If 
    End Sub 
    

代碼,我明白,很多開發商說,展望2010不能保留頭部信息,但我想知道是否有人找到了可行的解決方案。我主要對保留媒體查詢CSS感興趣,因爲它的當前狀態是移動樣式是什麼打破。如果沒有任何關於如何重新培訓媒體的建議,可以在outlook html電子郵件中查詢CSS樣式。

再次感謝。

回答

0

正如你可能知道Outlook使用Word作爲電子郵件編輯器。這就是爲什麼你會看到Thuderbird和Outlook之間的差異。以下系列文章提供了與受支持和不受支持的HTML元素,屬性和級聯樣式表屬性相關的參考文檔。

+0

感謝您的參考。所以基本上Outlook對媒體查詢的支持是0,而媒體查詢不能以任何方式插入,無論是通過強制VBA還是其他方式?微軟的輝煌!有沒有人制作軟件或提出解決方案來製作基於Outlook的響應式新聞稿?表格單元格百分比是我的下一個猜測。什麼可怕的軟件。再次感謝dev參考表 – Tenacity