57 lines
1.4 KiB
VB.net
57 lines
1.4 KiB
VB.net
Option Explicit On
|
|
|
|
Imports Microsoft.Office.Interop
|
|
Imports System.Windows.Forms
|
|
Imports Microsoft.Office.Core
|
|
Imports Microsoft.Office.Tools.Ribbon
|
|
|
|
'Option Private Module
|
|
'Imports Microsoft.Office.Core
|
|
|
|
Public Class ThisAddIn
|
|
Private WithEvents inspectors As Outlook.Inspectors
|
|
|
|
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
|
|
inspectors = Me.Application.Inspectors
|
|
|
|
AddHandler VERAGRibbon.bla, Sub()
|
|
' MsgBox("JOAS")
|
|
TestPrintFirstPage()
|
|
End Sub
|
|
End Sub
|
|
Private APP = Me.Application
|
|
|
|
|
|
|
|
Public Sub TestPrintFirstPage()
|
|
Dim Mail As Outlook.MailItem
|
|
Mail = Application.ActiveExplorer.Selection(1)
|
|
PrintFirstPage2(Mail)
|
|
End Sub
|
|
|
|
Public Sub PrintFirstPage2(Mail As Outlook.MailItem)
|
|
' Dim wdApp As Word.Application
|
|
' Dim wdDoc As Word.Document
|
|
' Dim olDoc As Word.Document
|
|
|
|
' wdApp = CreateObject("Word.Application")
|
|
' wdDoc = wdApp.Documents.Add(Visible:=True)
|
|
|
|
'' olDoc = Mail.GetInspector.WordEditor
|
|
' olDoc.Range.Copy()
|
|
' wdDoc.Range.Paste()
|
|
|
|
' wdDoc.PrintOut(Range:="wdPrintFromTo", From:="1", To:="1")
|
|
|
|
'DoEvents()
|
|
' wdDoc.Close(False)
|
|
' wdApp.Quit()
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|
|
|
|
|