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
bdsermons Outlook 365 command button in outlook form Outlook VBA and Custom Forms 4
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
G Outlook Express (DBX) to Outlook (PST) Conversion Software Wanted Using Outlook 0
J Outlook 2016 Can't display some embedded HTML images in Outlook 2016 Using Outlook 2
J Outlook EAS protocol version Using Outlook 1
N Outlook 2021 'Run Script" Rules? Outlook VBA and Custom Forms 4
C Why does Outlook (desktop) 365 for Windows keep making me input my passwords? Using Outlook 8
P Comcast IMAP broken but their second level support said to call "the Outlook company" Using Outlook 4
B iCloud telling me my Outlook is not supported Using Outlook 2
cheapfaremart Which outlook version is best? Using Outlook 0
T Outlook 2021 Cannot open attachments Outlook DeskTop 2021 Using Outlook 0
M Outlook settings will not accept a password Using Outlook 9
C Outlook FROM ADDRESS -Outlook.com and Android Using Outlook 1
E Outlook 365 Outlook/VBA Outlook VBA and Custom Forms 11
O How to find and replace a word in Outlook-Agenda-Subject and Message? Using Outlook 0
gproston Why doesn't Outlook remember indexing? Using Outlook 1
X Open Hyperlinks in an Outlook Email Message (Help with Diane's solution) Outlook VBA and Custom Forms 3
J Outlook 2003 .pst Will Not Restore Completely to Outlook 2019 Using Outlook 5

Similar threads

Top