Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2022, 01:01 AM
JamesMWood JamesMWood is offline ActiveExplorer().ActiveInlineResponse Windows 10 ActiveExplorer().ActiveInlineResponse Office 2021
Novice
ActiveExplorer().ActiveInlineResponse
 
Join Date: May 2022
Posts: 25
JamesMWood is on a distinguished road
Question ActiveExplorer().ActiveInlineResponse

Hi there

I'm making the switch from VB and started getting to grips with Visual Studio, so I'm not too sure if you'll be able to help or not. I have a sub where a button click attaches a file to a currently-open email draft. It works for ActiveInlineResponse, but I'm not too sure how to get it to work if it's a pop-out window etc. Thoughts? I think it might have something to do with Inspector, but I'm not sure how to implement it. Current code:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'Strings for enclosures
Dim filename As String
filename = "c:\temp\test.pdf"

'Add enclosures to draft email
Dim aMail As Outlook.MailItem
Dim outapp As New Outlook.Application()

aMail = outapp.ActiveExplorer().ActiveInlineResponse



With aMail
aMail.Attachments.Add(filename,
Outlook.OlAttachmentType.olByValue, 1)
CType(aMail, Outlook._MailItem).Save()
End With

End Sub



Thanks a lot
James
Reply With Quote
  #2  
Old 05-30-2022, 06:25 AM
JamesMWood JamesMWood is offline ActiveExplorer().ActiveInlineResponse Windows 10 ActiveExplorer().ActiveInlineResponse Office 2021
Novice
ActiveExplorer().ActiveInlineResponse
 
Join Date: May 2022
Posts: 25
JamesMWood is on a distinguished road
Default

Nevermind, I got it to work. For anyone curious:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'Strings for enclosures
Dim filename As String
filename = "c:\temp\test.pdf"

'Add enclosures to draft email
Dim aMail As Outlook.MailItem
Dim outapp As New Outlook.Application()
Dim oInspector As Outlook.Inspector
oInspector = outapp.ActiveInspector

'Determine if in line response or pop-out email reply
If oInspector Is Nothing Then
aMail = outapp.ActiveExplorer.ActiveInlineResponse
Else
aMail = oInspector.CurrentItem
End If

'Attach files
With aMail
aMail.Attachments.Add(filename,
Outlook.OlAttachmentType.olByValue, 1)
CType(aMail, Outlook._MailItem).Save()
End With

Hide() 'Hides form window after clicking attach button

End Sub
Reply With Quote
Reply

Tags
attachment, pop-out



Other Forums: Access Forums

All times are GMT -7. The time now is 01:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft