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
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
O Outlook - hidden contacts? Using Outlook 2
F Outlook 365 is "Possessed" Using Outlook 2
e_a_g_l_e_p_i Can someone explain syncing with Outlook and Gmail Using Outlook 3
K Outlook Office 365 VBA download attachment Outlook VBA and Custom Forms 2
e_a_g_l_e_p_i Gmail in Outlook 2010 preview issue Using Outlook 4
I Outlook is stuck at "Updating Calendar" Using Outlook 1
AmonRa Outlook 365 calendar - too much white space Using Outlook 0
e_a_g_l_e_p_i Outlook 2010 Help setting up Gmail account in Outlook 2010 Using Outlook 3
C-S-R How to clear an Outlook (To Do) Task Flag? Using Outlook 8
N How do I make Outlook autocomplete addresses from a list of recognised <full_names> only? Using Outlook 2
P Outlook 2019 UI changes after 20H2 update Using Outlook 1
R How to restrict GWSMO sync to Outlook Send/Receive cycles Using Outlook 0
B Outlook 2016 Unable to view images or logos on the outlook 2016 emails the same html code works well when i use outlook 2010 Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
M Outlook 2010 How could I globally redesign an outlook template form/region/inspector template used to display mail lists or an individual mails? Outlook VBA and Custom Forms 0
T The Linked Image Cannot Be Displayed in Outlook Using Outlook 5
M Outlook 2010 Outlook 2010 with O365 / Exchange Online Using Outlook 0

Similar threads

Top