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?
 
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?
 
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).
 
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).
 
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).


> .
>
 
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.
 
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
G Add Map It button to Custom Contacts Form in Outlook Outlook VBA and Custom Forms 1
J Outlook 2021 ScanPST errors (yet again ... sorry): repair button missing Outlook 2021 Using Outlook 5
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 2
bdsermons Outlook 365 command button in outlook form Outlook VBA and Custom Forms 5
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
M Outlook 2016 still feature updating Using Outlook 0
e_a_g_l_e_p_i Question about Outlook 2021 and Gmail Using Outlook 9
J Outlook VBA to send from Non-default Account & Data Files Outlook VBA and Custom Forms 2
P Limited Support for 3rd Party Mail in new Outlook? Using Outlook 1
O Any 3rd party tool that sync (mirror) from Outlook Calendar to Google Calendar? Using Outlook 5
T Outlook is categorizing emails incorrectly Using Outlook 1
R Legacy Outlook on Mac Email Cache Using Outlook 0
A Outlook can't remember outlook.com, Exchange password. Using Outlook 6
S Related messages show in main Outlook window vice new Advanced Find windows Using Outlook 1
H Force Outlook 2019 with GMail 2-Step to Require Login? Using Outlook 0
G Retaining Tabs in outlook body Using Outlook 2
V Setting up Outlook 2021 on new computer Using Outlook 2

Similar threads

Back
Top