Outlook 2007 lose the attatchment when sending through external sc

Status
Not open for further replies.
F

Fredrik

Hi.

I have an application where I am able to send a report that I've exported to

an pdf.

I plase the pdf-file in temp-dir and attatch it via an vbscript that calls

Outlook 2007.

It works just fine when it is displayd on the screen. The attatched file is

there and everything. But when I click on send, the recipient will not get

the file. The mail itselfs get through but not the attached file.

I have my own mailserver and can look in the logs and there I see that the

attached file is'nt there.

If I create a new mail inside ol2k7 and attach the same file that is droped

in temp-dir and then send it, it works just fine.

I'm not sure but my guesse is that there is som security glitch in ol2k7

that stops the file to be sent. Is that possible? And how do I work around it?

The same code works without any problems on ol2k3.

Realy thanks in advance.
 
D

Dmitry Streblechenko

Do you see the attachments when you look at the message in the Sent Items

folder?

Dmitry Streblechenko (MVP)

-

"Fredrik" <Fredrik> wrote in message

news:09BA1B48-20B4-4EDA-87C0-7146690BD00A@microsoft.com...
> Hi.
> I have an application where I am able to send a report that I've exported
> to
> an pdf.
> I plase the pdf-file in temp-dir and attatch it via an vbscript that calls
> Outlook 2007.

> It works just fine when it is displayd on the screen. The attatched file
> is
> there and everything. But when I click on send, the recipient will not get
> the file. The mail itselfs get through but not the attached file.
> I have my own mailserver and can look in the logs and there I see that the
> attached file is'nt there.

> If I create a new mail inside ol2k7 and attach the same file that is
> droped
> in temp-dir and then send it, it works just fine.
> I'm not sure but my guesse is that there is som security glitch in ol2k7
> that stops the file to be sent. Is that possible? And how do I work around
> it?

> The same code works without any problems on ol2k3.

> Realy thanks in advance.
 
F

Fredrik

Re: Outlook 2007 lose the attatchment when sending through externa

Yes I do. When I look in the Sent Items folder it has been sent with the

attached file. It's there and it is correct size and everything should work.

The recipient that is getting the mail with the attatched file has ol2k3.

Can it be becaus of that?

I have'nt had a chanse to try to an other recpient yet, that use ol2k7.

I think it's rather strange if that would be the case here.

I have tried some stuff now to and now when I look in the logs at the

mailserver I can see that the mail is in the correct size now. But it is

02:40 here now so I'll have to see tomorrow if the mail has arrived with the

attached file.

One thing I might add is that I don't send the mail via the vbscript. Iäm

letting the user see the mail and can write more info in the mail before

he/she sends it by clicking on send.

Thanks for your answeer.

"Dmitry Streblechenko" wrote:


> Do you see the attachments when you look at the message in the Sent Items
> folder?

> > Dmitry Streblechenko (MVP)
>

>

>

> -
> "Fredrik" <Fredrik> wrote in message
> news:09BA1B48-20B4-4EDA-87C0-7146690BD00A@microsoft.com...
> > Hi.
> > I have an application where I am able to send a report that I've exported
> > to
> > an pdf.
> > I plase the pdf-file in temp-dir and attatch it via an vbscript that calls
> > Outlook 2007.
> > It works just fine when it is displayd on the screen. The attatched file
> > is
> > there and everything. But when I click on send, the recipient will not get
> > the file. The mail itselfs get through but not the attached file.
> > I have my own mailserver and can look in the logs and there I see that the
> > attached file is'nt there.
> > If I create a new mail inside ol2k7 and attach the same file that is
> > droped
> > in temp-dir and then send it, it works just fine.
> > I'm not sure but my guesse is that there is som security glitch in ol2k7
> > that stops the file to be sent. Is that possible? And how do I work around
> > it?
> > The same code works without any problems on ol2k3.
> > Realy thanks in advance.


> .
>
 
F

Fredrik

Re: Outlook 2007 lose the attatchment when sending through externa

Okey. Feel that I have to add more info.

I just tried to see if the attached file will show up on hotmail. And it does.

Then I am pretty chor about the file is sent aswell.

What is the different between adding a attachment by hand on Outlook 2007

and by adding it by script?

And what is the different in between, what is the different between adding a

attachment by hand on Outlook 2003 and by adding it by script?

The code I am using is as following:

Const olMailItem = 0

Const olOriginator = 0

Const olByReference = 4

Const olByValue = 1

Const olEmbeddedItem = 5

Dim Outlook

Dim Message

Dim olFolderOutbox

Dim olFolderDrafts

Dim GetArgs

Dim I

olFolderOutbox = 4

olFolderDrafts = 16

On Error Resume Next

Set Outlook = GetObject(, "Outlook.Application")

If Outlook Is Nothing Then

Set Outlook = CreateObject("Outlook.Application")

End If

Err.Clear

On Error Goto 0

Set Message = Outlook.GetNameSpace("MAPI")._

GetDefaultFolder(olFolderDrafts)._

Items.Add("IPM.[Standard Forms Library].Message")

With Message

GetArgs = ""

GetArg "subject", GetArgs

> Subject = GetArgs

GetArgs = ""

GetArg "to", GetArgs

> Recipients.Add (GetArgs)

GetArgs = ""

GetArg "body", GetArgs

If Len(GetArgs) > 0 Then .Body = GetArgs

GetArgs = ""

GetArg "cc", GetArgs

If Len(GetArgs) > 0 Then .Cc = GetArgs

GetArgs = ""

GetArg "bcc", GetArgs

If Len(GetArgs) > 0 Then .Bcc = GetArgs

GetArgs = ""

GetArg "from", GetArgs

If Len(GetArgs) > 0 Then .Recipients.Add(GetArgs).Type = olOriginator

> Recipients.ResolveAll

> Save

For I = 1 To 5

GetArgs = ""

GetArg "attach" & CStr(I), GetArgs

If Len(GetArgs) > 0 Then

> attachments.Add GetArgs, 1, I

End If

Next

> Display

End With

Set Message = Nothing

Set Outlook = Nothing

'---------------------' Checks the command line arguments for a given switch and returns the

associated

' string, if found. If not found, the defaultValue is returned instead.

Function GetArg( sSwitch, sDefaultValue )

Dim ArgCount, bMatch

ArgCount = 0

bMatch = 0

Do While ArgCount < WScript.arguments.length

If Eval((WScript.arguments.item(ArgCount)) = ("-" + (sSwitch))) Or

Eval((WScript.arguments.item(ArgCount)) = ("/" + (sSwitch))) Then

bMatch = 1

Exit do

Else

ArgCount = ArgCount + 1

End If

Loop

If ( bMatch = 1 ) Then

GetArgs = ( WScript.arguments.item(ArgCount + 1) )

Else

GetArgs = ( sDefaultValue )

End If

End Function

I'm not getting any errors at all. It all works just fine. But what am I

missing?

Thanks in advance
 
D

Dmitry Streblechenko

Re: Outlook 2007 lose the attatchment when sending through externa

If you are sending in the RTF format (which is very likely since you havea

custom message class), you will get the infamous winmail.dat attachment with

teh TNEF data, which only Outlook can understand.

Try to send a message to an account taht yo ucan access with OE and then

look at the meaasge source (*right click, Properties| Details | Message

Source).

Dmitry Streblechenko (MVP)

-

"Fredrik" <Fredrik> wrote in message

news:F8E0B43C-56AD-4060-AA46-3CEE9B670E71@microsoft.com...
> Okey. Feel that I have to add more info.

> I just tried to see if the attached file will show up on hotmail. And it
> does.
> Then I am pretty chor about the file is sent aswell.

> What is the different between adding a attachment by hand on Outlook 2007
> and by adding it by script?
> And what is the different in between, what is the different between adding
> a
> attachment by hand on Outlook 2003 and by adding it by script?

> The code I am using is as following:

> Const olMailItem = 0
> Const olOriginator = 0
> Const olByReference = 4
> Const olByValue = 1
> Const olEmbeddedItem = 5
> Dim Outlook
> Dim Message
> Dim olFolderOutbox
> Dim olFolderDrafts
> Dim GetArgs
> Dim I

> olFolderOutbox = 4
> olFolderDrafts = 16

> On Error Resume Next
> Set Outlook = GetObject(, "Outlook.Application")
> If Outlook Is Nothing Then
> Set Outlook = CreateObject("Outlook.Application")
> End If
> Err.Clear
> On Error Goto 0

> Set Message = Outlook.GetNameSpace("MAPI")._
> GetDefaultFolder(olFolderDrafts)._
> Items.Add("IPM.[Standard Forms Library].Message")

> With Message
> GetArgs = ""
> GetArg "subject", GetArgs
> .Subject = GetArgs

> GetArgs = ""
> GetArg "to", GetArgs
> .Recipients.Add (GetArgs)

> GetArgs = ""
> GetArg "body", GetArgs
> If Len(GetArgs) > 0 Then .Body = GetArgs

> GetArgs = ""
> GetArg "cc", GetArgs
> If Len(GetArgs) > 0 Then .Cc = GetArgs

> GetArgs = ""
> GetArg "bcc", GetArgs
> If Len(GetArgs) > 0 Then .Bcc = GetArgs

> GetArgs = ""
> GetArg "from", GetArgs
> If Len(GetArgs) > 0 Then .Recipients.Add(GetArgs).Type = olOriginator
> .Recipients.ResolveAll

> .Save

> For I = 1 To 5
> GetArgs = ""
> GetArg "attach" & CStr(I), GetArgs
> If Len(GetArgs) > 0 Then
> .attachments.Add GetArgs, 1, I
> End If
> Next

> .Display
> End With

> Set Message = Nothing
> Set Outlook = Nothing

> '---------------------------------------------------> ' Checks the command line arguments for a given switch and returns the
> associated
> ' string, if found. If not found, the defaultValue is returned instead.
> Function GetArg( sSwitch, sDefaultValue )
> Dim ArgCount, bMatch

> ArgCount = 0
> bMatch = 0

> Do While ArgCount < WScript.arguments.length
> If Eval((WScript.arguments.item(ArgCount)) = ("-" + (sSwitch))) Or
> Eval((WScript.arguments.item(ArgCount)) = ("/" + (sSwitch))) Then
> bMatch = 1
> Exit do
> Else
> ArgCount = ArgCount + 1
> End If
> Loop

> If ( bMatch = 1 ) Then
> GetArgs = ( WScript.arguments.item(ArgCount + 1) )
> Else
> GetArgs = ( sDefaultValue )
> End If

> End Function

> I'm not getting any errors at all. It all works just fine. But what am I
> missing?

> Thanks in advance
 
F

Fredrik

Re: Outlook 2007 lose the attatchment when sending through externa

But if that is correct.. How come that users with Outlook 2003 does'nt get

the attachment either? And how come that hotmail works???

I will ofcourse try to do what you say.. :)

"Dmitry Streblechenko" wrote:


> If you are sending in the RTF format (which is very likely since you havea
> custom message class), you will get the infamous winmail.dat attachment with
> teh TNEF data, which only Outlook can understand.
> Try to send a message to an account taht yo ucan access with OE and then
> look at the meaasge source (*right click, Properties| Details | Message
> Source).
> > Dmitry Streblechenko (MVP)
>

>

>

> -
> "Fredrik" <Fredrik> wrote in message
> news:F8E0B43C-56AD-4060-AA46-3CEE9B670E71@microsoft.com...
> > Okey. Feel that I have to add more info.
> > I just tried to see if the attached file will show up on hotmail. And it
> > does.
> > Then I am pretty chor about the file is sent aswell.
> > What is the different between adding a attachment by hand on Outlook 2007
> > and by adding it by script?
> > And what is the different in between, what is the different between adding
> > a
> > attachment by hand on Outlook 2003 and by adding it by script?
> > The code I am using is as following:
> > Const olMailItem = 0
> > Const olOriginator = 0
> > Const olByReference = 4
> > Const olByValue = 1
> > Const olEmbeddedItem = 5
> > Dim Outlook
> > Dim Message
> > Dim olFolderOutbox
> > Dim olFolderDrafts
> > Dim GetArgs
> > Dim I
> > olFolderOutbox = 4
> > olFolderDrafts = 16
> > On Error Resume Next
> > Set Outlook = GetObject(, "Outlook.Application")
> > If Outlook Is Nothing Then
> > Set Outlook = CreateObject("Outlook.Application")
> > End If
> > Err.Clear
> > On Error Goto 0
> > Set Message = Outlook.GetNameSpace("MAPI")._
> > GetDefaultFolder(olFolderDrafts)._
> > Items.Add("IPM.[Standard Forms Library].Message")
> > With Message
> > GetArgs = ""
> > GetArg "subject", GetArgs
> > .Subject = GetArgs
> > GetArgs = ""
> > GetArg "to", GetArgs
> > .Recipients.Add (GetArgs)
> > GetArgs = ""
> > GetArg "body", GetArgs
> > If Len(GetArgs) > 0 Then .Body = GetArgs
> > GetArgs = ""
> > GetArg "cc", GetArgs
> > If Len(GetArgs) > 0 Then .Cc = GetArgs
> > GetArgs = ""
> > GetArg "bcc", GetArgs
> > If Len(GetArgs) > 0 Then .Bcc = GetArgs
> > GetArgs = ""
> > GetArg "from", GetArgs
> > If Len(GetArgs) > 0 Then .Recipients.Add(GetArgs).Type = olOriginator
> > .Recipients.ResolveAll
> > .Save
> > For I = 1 To 5
> > GetArgs = ""
> > GetArg "attach" & CStr(I), GetArgs
> > If Len(GetArgs) > 0 Then
> > .attachments.Add GetArgs, 1, I
> > End If
> > Next
> > .Display
> > End With
> > Set Message = Nothing
> > Set Outlook = Nothing
> > '---------------------------------------------------> > ' Checks the command line arguments for a given switch and returns the
> > associated
> > ' string, if found. If not found, the defaultValue is returned instead.
> > Function GetArg( sSwitch, sDefaultValue )
> > Dim ArgCount, bMatch
> > ArgCount = 0
> > bMatch = 0
> > Do While ArgCount < WScript.arguments.length
> > If Eval((WScript.arguments.item(ArgCount)) = ("-" + (sSwitch))) Or
> > Eval((WScript.arguments.item(ArgCount)) = ("/" + (sSwitch))) Then
> > bMatch = 1
> > Exit do
> > Else
> > ArgCount = ArgCount + 1
> > End If
> > Loop
> > If ( bMatch = 1 ) Then
> > GetArgs = ( WScript.arguments.item(ArgCount + 1) )
> > Else
> > GetArgs = ( sDefaultValue )
> > End If
> > End Function
> > I'm not getting any errors at all. It all works just fine. But what am I
> > missing?
> > Thanks in advance


> .
>
 
F

Fredrik

Re: Outlook 2007 lose the attatchment when sending through externa

Ahh.. I see what you mean..

But how do I change on that? The thing is that we have alot of costumers

that is useing this application and one of them is about 40 workers that uses

this code.

And trust me. I wont go araound to everyone and change any settings in

outlook to get this to work.. *LOL*

So can I by any chance change my code so it is the correct mimes and so on?

"Dmitry Streblechenko" wrote:


> If you are sending in the RTF format (which is very likely since you havea
> custom message class), you will get the infamous winmail.dat attachment with
> teh TNEF data, which only Outlook can understand.
> Try to send a message to an account taht yo ucan access with OE and then
> look at the meaasge source (*right click, Properties| Details | Message
> Source).
> > Dmitry Streblechenko (MVP)
>

>

>

> -
> "Fredrik" <Fredrik> wrote in message
> news:F8E0B43C-56AD-4060-AA46-3CEE9B670E71@microsoft.com...
> > Okey. Feel that I have to add more info.
> > I just tried to see if the attached file will show up on hotmail. And it
> > does.
> > Then I am pretty chor about the file is sent aswell.
> > What is the different between adding a attachment by hand on Outlook 2007
> > and by adding it by script?
> > And what is the different in between, what is the different between adding
> > a
> > attachment by hand on Outlook 2003 and by adding it by script?
> > The code I am using is as following:
> > Const olMailItem = 0
> > Const olOriginator = 0
> > Const olByReference = 4
> > Const olByValue = 1
> > Const olEmbeddedItem = 5
> > Dim Outlook
> > Dim Message
> > Dim olFolderOutbox
> > Dim olFolderDrafts
> > Dim GetArgs
> > Dim I
> > olFolderOutbox = 4
> > olFolderDrafts = 16
> > On Error Resume Next
> > Set Outlook = GetObject(, "Outlook.Application")
> > If Outlook Is Nothing Then
> > Set Outlook = CreateObject("Outlook.Application")
> > End If
> > Err.Clear
> > On Error Goto 0
> > Set Message = Outlook.GetNameSpace("MAPI")._
> > GetDefaultFolder(olFolderDrafts)._
> > Items.Add("IPM.[Standard Forms Library].Message")
> > With Message
> > GetArgs = ""
> > GetArg "subject", GetArgs
> > .Subject = GetArgs
> > GetArgs = ""
> > GetArg "to", GetArgs
> > .Recipients.Add (GetArgs)
> > GetArgs = ""
> > GetArg "body", GetArgs
> > If Len(GetArgs) > 0 Then .Body = GetArgs
> > GetArgs = ""
> > GetArg "cc", GetArgs
> > If Len(GetArgs) > 0 Then .Cc = GetArgs
> > GetArgs = ""
> > GetArg "bcc", GetArgs
> > If Len(GetArgs) > 0 Then .Bcc = GetArgs
> > GetArgs = ""
> > GetArg "from", GetArgs
> > If Len(GetArgs) > 0 Then .Recipients.Add(GetArgs).Type = olOriginator
> > .Recipients.ResolveAll
> > .Save
> > For I = 1 To 5
> > GetArgs = ""
> > GetArg "attach" & CStr(I), GetArgs
> > If Len(GetArgs) > 0 Then
> > .attachments.Add GetArgs, 1, I
> > End If
> > Next
> > .Display
> > End With
> > Set Message = Nothing
> > Set Outlook = Nothing
> > '---------------------------------------------------> > ' Checks the command line arguments for a given switch and returns the
> > associated
> > ' string, if found. If not found, the defaultValue is returned instead.
> > Function GetArg( sSwitch, sDefaultValue )
> > Dim ArgCount, bMatch
> > ArgCount = 0
> > bMatch = 0
> > Do While ArgCount < WScript.arguments.length
> > If Eval((WScript.arguments.item(ArgCount)) = ("-" + (sSwitch))) Or
> > Eval((WScript.arguments.item(ArgCount)) = ("/" + (sSwitch))) Then
> > bMatch = 1
> > Exit do
> > Else
> > ArgCount = ArgCount + 1
> > End If
> > Loop
> > If ( bMatch = 1 ) Then
> > GetArgs = ( WScript.arguments.item(ArgCount + 1) )
> > Else
> > GetArgs = ( sDefaultValue )
> > End If
> > End Function
> > I'm not getting any errors at all. It all works just fine. But what am I
> > missing?
> > Thanks in advance


> .
>
 
F

Fredrik

Re: Outlook 2007 lose the attatchment when sending through externa

I have manage to solve this issue..

You had answeered someone else about embeeded files and I managed to change

the code in that one to get to my result.

And I trimed it abit to. So you don't need to save an draft and you will get

the Signature from boyt outlook 2007 and 2003. I think I manage that anyway.

Just let me know if you like to see how I did.

Many thanks for the suggestions what was wrong.

Fredrik.

"Dmitry Streblechenko" wrote:


> If you are sending in the RTF format (which is very likely since you havea
> custom message class), you will get the infamous winmail.dat attachment with
> teh TNEF data, which only Outlook can understand.
> Try to send a message to an account taht yo ucan access with OE and then
> look at the meaasge source (*right click, Properties| Details | Message
> Source).
> > Dmitry Streblechenko (MVP)
>

>

>

> -
> "Fredrik" <Fredrik> wrote in message
> news:F8E0B43C-56AD-4060-AA46-3CEE9B670E71@microsoft.com...
> > Okey. Feel that I have to add more info.
> > I just tried to see if the attached file will show up on hotmail. And it
> > does.
> > Then I am pretty chor about the file is sent aswell.
> > What is the different between adding a attachment by hand on Outlook 2007
> > and by adding it by script?
> > And what is the different in between, what is the different between adding
> > a
> > attachment by hand on Outlook 2003 and by adding it by script?
> > The code I am using is as following:
> > Const olMailItem = 0
> > Const olOriginator = 0
> > Const olByReference = 4
> > Const olByValue = 1
> > Const olEmbeddedItem = 5
> > Dim Outlook
> > Dim Message
> > Dim olFolderOutbox
> > Dim olFolderDrafts
> > Dim GetArgs
> > Dim I
> > olFolderOutbox = 4
> > olFolderDrafts = 16
> > On Error Resume Next
> > Set Outlook = GetObject(, "Outlook.Application")
> > If Outlook Is Nothing Then
> > Set Outlook = CreateObject("Outlook.Application")
> > End If
> > Err.Clear
> > On Error Goto 0
> > Set Message = Outlook.GetNameSpace("MAPI")._
> > GetDefaultFolder(olFolderDrafts)._
> > Items.Add("IPM.[Standard Forms Library].Message")
> > With Message
> > GetArgs = ""
> > GetArg "subject", GetArgs
> > .Subject = GetArgs
> > GetArgs = ""
> > GetArg "to", GetArgs
> > .Recipients.Add (GetArgs)
> > GetArgs = ""
> > GetArg "body", GetArgs
> > If Len(GetArgs) > 0 Then .Body = GetArgs
> > GetArgs = ""
> > GetArg "cc", GetArgs
> > If Len(GetArgs) > 0 Then .Cc = GetArgs
> > GetArgs = ""
> > GetArg "bcc", GetArgs
> > If Len(GetArgs) > 0 Then .Bcc = GetArgs
> > GetArgs = ""
> > GetArg "from", GetArgs
> > If Len(GetArgs) > 0 Then .Recipients.Add(GetArgs).Type = olOriginator
> > .Recipients.ResolveAll
> > .Save
> > For I = 1 To 5
> > GetArgs = ""
> > GetArg "attach" & CStr(I), GetArgs
> > If Len(GetArgs) > 0 Then
> > .attachments.Add GetArgs, 1, I
> > End If
> > Next
> > .Display
> > End With
> > Set Message = Nothing
> > Set Outlook = Nothing
> > '---------------------------------------------------> > ' Checks the command line arguments for a given switch and returns the
> > associated
> > ' string, if found. If not found, the defaultValue is returned instead.
> > Function GetArg( sSwitch, sDefaultValue )
> > Dim ArgCount, bMatch
> > ArgCount = 0
> > bMatch = 0
> > Do While ArgCount < WScript.arguments.length
> > If Eval((WScript.arguments.item(ArgCount)) = ("-" + (sSwitch))) Or
> > Eval((WScript.arguments.item(ArgCount)) = ("/" + (sSwitch))) Then
> > bMatch = 1
> > Exit do
> > Else
> > ArgCount = ArgCount + 1
> > End If
> > Loop
> > If ( bMatch = 1 ) Then
> > GetArgs = ( WScript.arguments.item(ArgCount + 1) )
> > Else
> > GetArgs = ( sDefaultValue )
> > End If
> > End Function
> > I'm not getting any errors at all. It all works just fine. But what am I
> > missing?
> > Thanks in advance


> .
>
 
D

Dmitry Streblechenko

Re: Outlook 2007 lose the attatchment when sending through externa

Did you end up using a standard message class (IPM.Note) or set the UseTnef

MAPI property to false?

Dmitry Streblechenko (MVP)

-

"Fredrik" <Fredrik> wrote in message

news:FE669357-4362-433D-B028-4EC8E9D4D95F@microsoft.com...
> I have manage to solve this issue..
> You had answeered someone else about embeeded files and I managed to
> change
> the code in that one to get to my result.
> And I trimed it abit to. So you don't need to save an draft and you will
> get
> the Signature from boyt outlook 2007 and 2003. I think I manage that
> anyway.
> Just let me know if you like to see how I did.

> Many thanks for the suggestions what was wrong.

>

> Fredrik.

> "Dmitry Streblechenko" wrote:
>
> > If you are sending in the RTF format (which is very likely since you
> > havea
> > custom message class), you will get the infamous winmail.dat attachment
> > with
> > teh TNEF data, which only Outlook can understand.
> > Try to send a message to an account taht yo ucan access with OE and then
> > look at the meaasge source (*right click, Properties| Details | Message
> > Source).
> > > > Dmitry Streblechenko (MVP)
> >

> >

> >

> > -
> > "Fredrik" <Fredrik> wrote in message
> > news:F8E0B43C-56AD-4060-AA46-3CEE9B670E71@microsoft.com...
> > > Okey. Feel that I have to add more info.
> >> > I just tried to see if the attached file will show up on hotmail. And
> > > it
> > > does.
> > > Then I am pretty chor about the file is sent aswell.
> >> > What is the different between adding a attachment by hand on Outlook
> > > 2007
> > > and by adding it by script?
> > > And what is the different in between, what is the different between
> > > adding
> > > a
> > > attachment by hand on Outlook 2003 and by adding it by script?
> >> > The code I am using is as following:
> >> > Const olMailItem = 0
> > > Const olOriginator = 0
> > > Const olByReference = 4
> > > Const olByValue = 1
> > > Const olEmbeddedItem = 5
> > > Dim Outlook
> > > Dim Message
> > > Dim olFolderOutbox
> > > Dim olFolderDrafts
> > > Dim GetArgs
> > > Dim I
> >> > olFolderOutbox = 4
> > > olFolderDrafts = 16
> >> > On Error Resume Next
> > > Set Outlook = GetObject(, "Outlook.Application")
> > > If Outlook Is Nothing Then
> > > Set Outlook = CreateObject("Outlook.Application")
> > > End If
> > > Err.Clear
> > > On Error Goto 0
> >> > Set Message = Outlook.GetNameSpace("MAPI")._
> > > GetDefaultFolder(olFolderDrafts)._
> > > Items.Add("IPM.[Standard Forms Library].Message")
> >> > With Message
> > > GetArgs = ""
> > > GetArg "subject", GetArgs
> > > .Subject = GetArgs
> >> > GetArgs = ""
> > > GetArg "to", GetArgs
> > > .Recipients.Add (GetArgs)
> >> > GetArgs = ""
> > > GetArg "body", GetArgs
> > > If Len(GetArgs) > 0 Then .Body = GetArgs
> >> > GetArgs = ""
> > > GetArg "cc", GetArgs
> > > If Len(GetArgs) > 0 Then .Cc = GetArgs
> >> > GetArgs = ""
> > > GetArg "bcc", GetArgs
> > > If Len(GetArgs) > 0 Then .Bcc = GetArgs
> >> > GetArgs = ""
> > > GetArg "from", GetArgs
> > > If Len(GetArgs) > 0 Then .Recipients.Add(GetArgs).Type =
> > > olOriginator
> > > .Recipients.ResolveAll
> >> > .Save
> >> > For I = 1 To 5
> > > GetArgs = ""
> > > GetArg "attach" & CStr(I), GetArgs
> > > If Len(GetArgs) > 0 Then
> > > .attachments.Add GetArgs, 1, I
> > > End If
> > > Next
> >> > .Display
> > > End With
> >> > Set Message = Nothing
> > > Set Outlook = Nothing
> >> > '---------------------------------------------------> > > ' Checks the command line arguments for a given switch and returns the
> > > associated
> > > ' string, if found. If not found, the defaultValue is returned instead.
> > > Function GetArg( sSwitch, sDefaultValue )
> > > Dim ArgCount, bMatch
> >> > ArgCount = 0
> > > bMatch = 0
> >> > Do While ArgCount < WScript.arguments.length
> > > If Eval((WScript.arguments.item(ArgCount)) = ("-" + (sSwitch)))
> > > Or
> > > Eval((WScript.arguments.item(ArgCount)) = ("/" + (sSwitch))) Then
> > > bMatch = 1
> > > Exit do
> > > Else
> > > ArgCount = ArgCount + 1
> > > End If
> > > Loop
> >> > If ( bMatch = 1 ) Then
> > > GetArgs = ( WScript.arguments.item(ArgCount + 1) )
> > > Else
> > > GetArgs = ( sDefaultValue )
> > > End If
> >> > End Function
> >>> > I'm not getting any errors at all. It all works just fine. But what am
> > > I
> > > missing?
> >> > Thanks in advance

>

>
>> .
> >
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Scared to lose data using iCloud with Outlook 2007 Using Outlook 2
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
S Outlook 2007 crash linked to gdiplus.dll Using Outlook 0
S Outlook 2007 - Automatic purge fail Using Outlook 0
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
D Outlook 2007 vs. Outlook 2010 -- ToDo Bar Using Outlook 0
D Outlook 2007 on 365 Using Outlook.com accounts in Outlook 2
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Verwendung von Outlook 2007 Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
M PST import from Outlook 2007 to 2010 - Address Book contacts all in 1 group Using Outlook 4
S outlook 2007 calendar search Using Outlook 6
B Migrate Outlook 2007 to Office 365 Using Outlook 3
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
R Outlook 2007 only loads some appointments Using Outlook 0
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
J Outlook 2007 Hide Messages Option not Available Using Outlook 2
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
B Server errors Outlook 2007 Using Outlook 1
S Reboot of frozen windows7 results in changed outlook 2007 settings Using Outlook 1
S Outlook 2007 printing wrong email address at top of page Using Outlook 8
M Configure outlook 2007 to accept digital signatures Using Outlook 2
D Outlook 2007 crashes when opening an email Using Outlook 2
R New chap saying hello and needing advice on Outlook 2007 thumbnails Using Outlook 3
icacream From Outlook 2007 to 2016 ! Using Outlook 9
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S Outlook 2007: Address Cards allow entering text! Why? Using Outlook 3
S View Appointment in Text Wrap in Outlook 2007 Month Calendar View Using Outlook 0
L Outlook 2007 Separate the Send/Receive functions Using Outlook 2
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
C Move from Outlook 2007 Enterprise (MOE) to Outlook Pro plus 2007 Using Outlook 1
J reinstalling Outlook 2007 asking for user name & password Using Outlook 14
P outlook addin unloaded in office 2007 Using Outlook 0
B Fonts in Outlook 2007 Using Outlook 4
R Add Exchange Account to existing POP3 Outlook 2007 Profile Using Outlook 0
C out of space in file group Outlook 2007 Using Outlook 2
A Moving archived contents in Outlook 2007 back into working folders Using Outlook 0
P Outlook 2007 Email Categorization using VBA Outlook VBA and Custom Forms 1
M Unable to Configure Gmail Account in Outlook 2007 Using Outlook 1
R Outlook 2007 or 2010 - Lock Down Functionality Outlook VBA and Custom Forms 3
S Outlook 2007, windows 10 Font size Using Outlook 1
Diane Poremsky Manually create a POP3 account in Outlook 2007 Using Outlook 0
J Can Click to Drag Custom Form Field But Cannot Drop When Designing in Outlook 2007 Outlook VBA and Custom Forms 2
L Outlook 2007 Font Using Outlook 3
J Outlook 2007 connector and Windows 10 Using Outlook 3
R Outlook 2007 - Shared Accounts and Resources without Exchange Server Using Outlook 0
L Outlook 2007 - Macro Re Search Using Outlook 16
D Outlook (Office) 2007 & Windows 10 Pro Using Outlook 6

Similar threads

Top