Outlook's button 'Attach File' does not work

Status
Not open for further replies.
T

Tanya

I am creating simple mail using Microsoft.Office.Interop.Outlook. I do not

want to attach file in the code - I need simple mail without any attach. Mail

is successfully created and opened, but after this button 'Attach File' does

not work (it could be clicked, file could be selected but it is not

attached). Here is simple code:

Dim Outlook As New Outlook.Application

Dim OutlookMessage As Outlook.MailItem

OutlookMessage = Outlook.CreateItem(OlItemType.olMailItem)

OutlookMessage.Display()

I am using Outlook 2007.

Could anyone help me with this?
 
K

Ken Slovak - [MVP - Outlook]

Where is this code running? Is it in an Outlook addin or standalone code or

what?

Do you get any errors when you try to attach something or does it just not

work?

Does the Attach File button in the Insert tab work?

Does Attach File work if you open an item yourself and not with code?

Offhand I can't see any reason why that code wouldn't allow an opened item

to attach things.

"Tanya" <Tanya> wrote in message

news:C2E1A06C-CAC0-45E5-BE1F-2FC663715B6E@microsoft.com...
> I am creating simple mail using Microsoft.Office.Interop.Outlook. I do not
> want to attach file in the code - I need simple mail without any attach.
> Mail
> is successfully created and opened, but after this button 'Attach File'
> does
> not work (it could be clicked, file could be selected but it is not
> attached). Here is simple code:

> Dim Outlook As New Outlook.Application
> Dim OutlookMessage As Outlook.MailItem
> OutlookMessage = Outlook.CreateItem(OlItemType.olMailItem)
> OutlookMessage.Display()

> I am using Outlook 2007.

> Could anyone help me with this?
 
T

Tanya

This code is running from standalone application. It is VB.Net code, you

could run it and then in opened Outlook window press Attach File button in

the Insert tab. As I said it works a bit funny - attached file is not shown

but will be sent. In case new mail is created from Outlook this button works

fine. Nevertherless, after opening saved .msg file - same strange behaviuor.

(Outlook must be closed before doing this).
 
K

Ken Slovak - [MVP - Outlook]

Please leave some of the preceding thread, it makes it very hard to maintain

context otherwise.

I'm completely confused now. What do MSG files have to do with anything?

You're now saying if the new mail is created from Outlook the button works?

That's what you said didn't work before.

"Tanya" <Tanya> wrote in message

news:9277A80D-EA84-4F07-8716-44799E1C4FE5@microsoft.com...
> This code is running from standalone application. It is VB.Net code, you
> could run it and then in opened Outlook window press Attach File button
> in
> the Insert tab. As I said it works a bit funny - attached file is not
> shown
> but will be sent. In case new mail is created from Outlook this button
> works
> fine. Nevertherless, after opening saved .msg file - same strange
> behaviuor.
> (Outlook must be closed before doing this).
 
T

Tanya

Here is code in VB.Net:

Dim Outlook As New Outlook.Application

Dim OutlookMessage As Outlook.MailItem

OutlookMessage = Outlook.CreateItem(OlItemType.olMailItem)

OutlookMessage.Display()

This code is running from standalone application. It creates empty mail.

This mail is opened in Outlook window. This window has tab 'Insert' which has

button 'Attach file'. If you run this code and press this button you will

see that it works strange - file can be selected but won't be shown.

In case new mail is created from Outlook this button works fine.
wrote:


> Please leave some of the preceding thread, it makes it very hard to maintain
> context otherwise.

> I'm completely confused now. What do MSG files have to do with anything?

> You're now saying if the new mail is created from Outlook the button works?
> That's what you said didn't work before.

> >

>

> "Tanya" <Tanya> wrote in message
> news:9277A80D-EA84-4F07-8716-44799E1C4FE5@microsoft.com...
> > This code is running from standalone application. It is VB.Net code, you
> > could run it and then in opened Outlook window press Attach File button
> > in
> > the Insert tab. As I said it works a bit funny - attached file is not
> > shown
> > but will be sent. In case new mail is created from Outlook this button
> > works
> > fine. Nevertherless, after opening saved .msg file - same strange
> > behaviuor.
> > (Outlook must be closed before doing this).


> .
>
 
K

Ken Slovak - [MVP - Outlook]

I can't repro this here. Using code like yours produces an email where all

the buttons and menu items work correctly.

"Tanya" <Tanya> wrote in message

news:4671AAAB-CD37-4275-BE44-EC761C902AB1@microsoft.com...
> Here is code in VB.Net:

> Dim Outlook As New Outlook.Application
> Dim OutlookMessage As Outlook.MailItem
> OutlookMessage = Outlook.CreateItem(OlItemType.olMailItem)
> OutlookMessage.Display()

> This code is running from standalone application. It creates empty mail.
> This mail is opened in Outlook window. This window has tab 'Insert' which
> has
> button 'Attach file'. If you run this code and press this button you will
> see that it works strange - file can be selected but won't be shown.

> In case new mail is created from Outlook this button works fine.
 
K

Ken Slovak - [MVP - Outlook]

Please leave part of the preceding thread in your posts.

So if Outlook wasn't already running you get this? Then start Outlook, use

GetNameSpace("MAPI") to logon and maybe wait a bit to let Outlook finish

starting up. Then do the rest of the code. If that isn't enough you might

need to display Explorer UI (using the GetExplorer method).

"Tanya" <Tanya> wrote in message

news:2D26A5C4-82F6-4FE6-B9F7-05E3EEA65420@microsoft.com...
> Bug is reproduced with closed Outlook only.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
I Button PDF in Outlook Contact custom form Outlook VBA and Custom Forms 1
C iCloud Setting missing Outlook tab and Outlook missing the iCloud refresh button Using Outlook 4
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
J Command Button to stamp a date and time in a textbox in Outlook 2016 Outlook VBA and Custom Forms 3
J Execute Add-In Button from VBA Outlook 2016 Outlook VBA and Custom Forms 1
Wayne Dardis Calling Ribbon Button in Outlook 2016 Outlook VBA and Custom Forms 6
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
E Outlook 2007: Problem with "Move to Folder >" button on toolbar Using Outlook 6
H Preventing the Send button from being clicked on an Outlook Form Outlook VBA and Custom Forms 1
G Moving "Delete" button on Outlook for Mac Using Outlook 1
R Outlook 2013 People Pane - Where is the "Add" button for social networks? Using Outlook 4
J Outlook 2003 freezing when clicking on TO button Using Outlook 2
M Open new outlook form from within existing outlook form using command button Using Outlook 4
A outlook 2013 people hub :: phone button Using Outlook 1
D Outlook 2007 Scheduling assistant button missing Using Outlook 1
B Greying out the theme button in outlook Using Outlook 0
C Missing "Customise Outlook Today" button Using Outlook 4
P Minimize button causes Outlook to close 2007 Using Outlook 1
C How do I set up an option button in and Outlook form? Outlook VBA and Custom Forms 1
A Custom form - hitting 'next item' button hangs Outlook Outlook VBA and Custom Forms 2
S Outlook Email Help: Select custom voting button options VBA Outlook VBA and Custom Forms 1
D Outlook 2003 saving option button Outlook VBA and Custom Forms 1
G Outlook 2007 Meeting Item Send Button Outlook VBA and Custom Forms 10
N Disable control CTRL button when dragging items/folders - Outlook Outlook VBA and Custom Forms 2
J How to hide/disable send button in Outlook 2007 Outlook VBA and Custom Forms 1
J How to hide/disable send button in Outlook 2007 Outlook VBA and Custom Forms 2
J How to hide/disable send button in Outlook 2007 Outlook VBA and Custom Forms 1
T Customize button image for separate Outlook forms region Outlook VBA and Custom Forms 2
W Override the 'To' Button in Outlook Outlook VBA and Custom Forms 3
R About state of encrypt and sign button for outlook? Outlook VBA and Custom Forms 7
R Encrypt and sign button while word is editor for outlook? Outlook VBA and Custom Forms 6
U Not able to delete Add-in button from multiple Outlook Explorer Outlook VBA and Custom Forms 1
C How to assign icon to a button in Outlook Add-in Outlook VBA and Custom Forms 1
witzker Outlook 2019 Pls. add a Prefix for OUTLOOK 2019 here Using Outlook 1
H Outlook 2019 intermittent search results Using Outlook 0
hstein POP3 latest Outlook Using Outlook 0
V Outlook 2003 and Windows 11 Using Outlook 4
J How to import many msg into different public folders in Outlook Outlook VBA and Custom Forms 7
I Outlook for Mac 2019 using on desktop and laptop IMAP on both need help with folders Using Outlook 1
A Reminder duplication Outlook and Outlook.com Using Outlook.com accounts in Outlook 5
F Moving Outlook to new PC Using Outlook 0
mll persistently customise columns in outlook advanced search Using Outlook 3
Ken Pascoe Outlook Categories Quick List Using Outlook 0
M All fonts in Outlook emails display with exaggerated character spacing Using Outlook 1
talla Can't open Outlook Item. Using Outlook 0
C Can't Locate an Unread Message in my Outlook view pane Using Outlook 0
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
P Importing other e-mail accounts into Outlook Using Outlook 1
J Read Outlook Form fields Outlook VBA and Custom Forms 3
B Inconsistent handling of message read/unread status by Outlook Using Outlook 3

Similar threads

Top