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
T Outlook Template - textbox visible based on combobox selection Using Outlook 1
D We're sorry but outlook has run into an error Using Outlook 1
F Outlook 2010 Outlook 2010 and GMail Using Outlook 0
M Reverting The Outlook Search Box Location (or other undesired additions) Using Outlook 1
M Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 4
P i-Phone 6s Plus receiving 2 notifications from Outlook email Using Outlook 1
C WARNING - DO NOT USE AN OUTLOOK.COM ADDRESS FOR GOOGLE ACCOUNT RECOVERY EMAIL Using Outlook 10
D Outlook 2016 Unable to load Outlook data pst file Using Outlook 5
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
R Why doesn't outlook use "Normal" style for new messages? Using Outlook 3
D Outlook 2016 Outlook not saving Sent Items Using Outlook 4
R How to Sync *all* Google Workspace Mail Folders with Outlook 2019 (MS365) Using Outlook 3
G Outlook 365 with iCloud account not syncing calendars Using Outlook 2
D Outlook 2016 Outlook Error Msg "The operation cannot be performed ..." How to Stop it Using Outlook 3
D Outlook.com premium finally dying... what do I do with my domain? Using Outlook.com accounts in Outlook 3
witzker Outlook 2019 is cutting Picture Extension *.pn_ Using Outlook 3
S Is there a free version of outlook? Using Outlook 0

Similar threads

Top