(Msg. 1) Posted: Tue Jul 01, 2008 5:56 am
Post subject: changing locating inbox Via VB HELP Archived from groups: microsoft>public>outlook>program_vba (more info?)
hi all i have this macro i gained from
http://www.fontstuff.com/outlook/oltut01.htm to remove all attatchments from
my emails and putting them directly into a folder selected by myself but this
works only for my default mailbox however i would like to change this to
another account as tis is required onl for this inbox. the code is as follows
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim varResponse As VbMsgBoxResult
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
i believe i need to change something on the last line
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
but dont understand or no what the code is. im not at all affuent in VBA
coding for Outlook but have some understanding for excel and access so any
help would be appreciated.
(Msg. 2) Posted: Tue Jul 01, 2008 9:37 am
Post subject: Re: changing locating inbox Via VB HELP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
That line needs to be changed to use the NameSpace.GetSharedDefaultFolder()
method. Look in the VBA Object Browser for more on that method, but you
basically suppy a Recipient object and folder type somewhat like this:
Dim oRecip As Outlook.Recipient
Set oRecip = ns.CreateRecipient("Joe Foobar")
If oRecip.Resolve() Then
Dim otherInbox As Outlook.MAPIFolder
Set otherInbox = ns.GetSharedDefaultFolder(oRecip, olFolderInbox)
Else
'could not create recipient
End If
"Rivers" <Rivers.RemoveThis@discussions.microsoft.com> wrote in message
news:CCC07D6D-C18C-4C4C-9E3C-C28685CB1CCF@microsoft.com...
> hi all i have this macro i gained from
> http://www.fontstuff.com/outlook/oltut01.htm to remove all attatchments
> from
> my emails and putting them directly into a folder selected by myself but
> this
> works only for my default mailbox however i would like to change this to
> another account as tis is required onl for this inbox. the code is as
> follows
>
> Dim ns As NameSpace
> Dim Inbox As MAPIFolder
> Dim SubFolder As MAPIFolder
> Dim Item As Object
> Dim Atmt As Attachment
> Dim FileName As String
> Dim i As Integer
> Dim varResponse As VbMsgBoxResult
> Set ns = GetNamespace("MAPI")
> Set Inbox = ns.GetDefaultFolder(olFolderInbox)
>
> i believe i need to change something on the last line
> Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> but dont understand or no what the code is. im not at all affuent in VBA
> coding for Outlook but have some understanding for excel and access so any
> help would be appreciated.
>
> thanks
>
> Rivers
>
(Msg. 3) Posted: Tue Jul 01, 2008 9:37 am
Post subject: Re: changing locating inbox Via VB HELP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
unfortunatly i dont understand why we need a recipriant?
heres my code:
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim varResponse As VbMsgBoxResult
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set SubFolder = Inbox.Folders("Copied in on") ' Enter correct subfolder
name.
I need to set my inbox line to my new mail inbox called "Main Dep" so where
the line " Set Inbox = ns.GetDefaultFolder(olFolderInbox)" states default i
would like to set to inbox = "Main Dep" im sorry if this has already been
xplained but i didnt understand please help
Rivers
"Ken Slovak - [MVP - Outlook]" wrote:
> That line needs to be changed to use the NameSpace.GetSharedDefaultFolder()
> method. Look in the VBA Object Browser for more on that method, but you
> basically suppy a Recipient object and folder type somewhat like this:
>
> Dim oRecip As Outlook.Recipient
>
> Set oRecip = ns.CreateRecipient("Joe Foobar")
> If oRecip.Resolve() Then
> Dim otherInbox As Outlook.MAPIFolder
> Set otherInbox = ns.GetSharedDefaultFolder(oRecip, olFolderInbox)
> Else
> 'could not create recipient
> End If
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com > Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm >
>
> "Rivers" <Rivers.DeleteThis@discussions.microsoft.com> wrote in message
> news:CCC07D6D-C18C-4C4C-9E3C-C28685CB1CCF@microsoft.com...
> > hi all i have this macro i gained from
> > http://www.fontstuff.com/outlook/oltut01.htm to remove all attatchments
> > from
> > my emails and putting them directly into a folder selected by myself but
> > this
> > works only for my default mailbox however i would like to change this to
> > another account as tis is required onl for this inbox. the code is as
> > follows
> >
> > Dim ns As NameSpace
> > Dim Inbox As MAPIFolder
> > Dim SubFolder As MAPIFolder
> > Dim Item As Object
> > Dim Atmt As Attachment
> > Dim FileName As String
> > Dim i As Integer
> > Dim varResponse As VbMsgBoxResult
> > Set ns = GetNamespace("MAPI")
> > Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> >
> > i believe i need to change something on the last line
> > Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> > but dont understand or no what the code is. im not at all affuent in VBA
> > coding for Outlook but have some understanding for excel and access so any
> > help would be appreciated.
> >
> > thanks
> >
> > Rivers
> >
>
>
(Msg. 4) Posted: Tue Jul 01, 2008 2:00 pm
Post subject: Re: changing locating inbox Via VB HELP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
To open a folder (Inbox) in a different mailbox than your own you need to
use GetSharedDefaultFolder(), as I said. You need a recipient object because
that's what that method requires. I showed you the code needed, all you have
to do is substitute the name of the owner of that mailbox to make it work.
"Rivers" <Rivers.TakeThisOut@discussions.microsoft.com> wrote in message
news:23A98670-F220-46C2-9BF5-D2BA6F9902CB@microsoft.com...
> unfortunatly i dont understand why we need a recipriant?
>
> heres my code:
> Dim ns As NameSpace
> Dim Inbox As MAPIFolder
> Dim SubFolder As MAPIFolder
> Dim Item As Object
> Dim Atmt As Attachment
> Dim FileName As String
> Dim i As Integer
> Dim varResponse As VbMsgBoxResult
> Set ns = GetNamespace("MAPI")
> Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> Set SubFolder = Inbox.Folders("Copied in on") ' Enter correct subfolder
> name.
>
> I need to set my inbox line to my new mail inbox called "Main Dep" so
> where
> the line " Set Inbox = ns.GetDefaultFolder(olFolderInbox)" states default
> i
> would like to set to inbox = "Main Dep" im sorry if this has already been
> xplained but i didnt understand please help
>
> Rivers
(Msg. 5) Posted: Wed Jul 02, 2008 6:40 am
Post subject: Re: changing locating inbox Via VB HELP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Hi Ken im sorry for sounding like a total noob but outlook classess and
methods are alien to myself ive tried to incorperate your code within the new
code and it gives me an error "Object could not be found" can you please
point out where im going wrong. the code is as follows
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim SubFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Dim varResponse As VbMsgBoxResult
Dim oRecip As Outlook.Recipient
Dim otherInbox As Outlook.MAPIFolder
Set ns = GetNamespace("MAPI")
Set oRecip = ns.CreateRecipient("Main")
If oRecip.Resolve() Then
Set otherInbox = ns.GetSharedDefaultFolder(oRecip, olFolderInbox)
Else
MsgBox "No Mailbox"
End If
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set SubFolder = otherInbox.Folders("Flash Recieved")
thank you again your time is greatly appreciated
"Ken Slovak - [MVP - Outlook]" wrote:
> To open a folder (Inbox) in a different mailbox than your own you need to
> use GetSharedDefaultFolder(), as I said. You need a recipient object because
> that's what that method requires. I showed you the code needed, all you have
> to do is substitute the name of the owner of that mailbox to make it work.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com > Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm >
>
> "Rivers" <Rivers.TakeThisOut@discussions.microsoft.com> wrote in message
> news:23A98670-F220-46C2-9BF5-D2BA6F9902CB@microsoft.com...
> > unfortunatly i dont understand why we need a recipriant?
> >
> > heres my code:
> > Dim ns As NameSpace
> > Dim Inbox As MAPIFolder
> > Dim SubFolder As MAPIFolder
> > Dim Item As Object
> > Dim Atmt As Attachment
> > Dim FileName As String
> > Dim i As Integer
> > Dim varResponse As VbMsgBoxResult
> > Set ns = GetNamespace("MAPI")
> > Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> > Set SubFolder = Inbox.Folders("Copied in on") ' Enter correct subfolder
> > name.
> >
> > I need to set my inbox line to my new mail inbox called "Main Dep" so
> > where
> > the line " Set Inbox = ns.GetDefaultFolder(olFolderInbox)" states default
> > i
> > would like to set to inbox = "Main Dep" im sorry if this has already been
> > xplained but i didnt understand please help
> >
> > Rivers
>
>
(Msg. 6) Posted: Wed Jul 02, 2008 9:50 am
Post subject: Re: changing locating inbox Via VB HELP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Is "Main" the name of that mailbox you want to log into? You need to use the
actual name of the user who owns that mailbox, for example for me on my
Exchange server it would be "Ken Slovak".
What line fires the error? Put your cursor in the code and set a breakpoint
on the Set ns = GetNameSpace("MAPI") line. When you hit the breakpoint step
the code (F until you get to the line that fires the error.
You also need to make sure that the permissions of the logon that's running
this code are set so that logon has permissions to log into the mailbox, the
Inbox there and the "Flash Received" folder under that Inbox.
"Rivers" <Rivers.RemoveThis@discussions.microsoft.com> wrote in message
news:829E0130-AAA7-4488-B501-5F4E6842829C@microsoft.com...
> Hi Ken im sorry for sounding like a total noob but outlook classess and
> methods are alien to myself ive tried to incorperate your code within the
> new
> code and it gives me an error "Object could not be found" can you please
> point out where im going wrong. the code is as follows
>
> Dim ns As NameSpace
> Dim Inbox As MAPIFolder
> Dim SubFolder As MAPIFolder
> Dim Item As Object
> Dim Atmt As Attachment
> Dim FileName As String
> Dim i As Integer
> Dim varResponse As VbMsgBoxResult
> Dim oRecip As Outlook.Recipient
>
> Dim otherInbox As Outlook.MAPIFolder
> Set ns = GetNamespace("MAPI")
> Set oRecip = ns.CreateRecipient("Main")
>
> If oRecip.Resolve() Then
>
> Set otherInbox = ns.GetSharedDefaultFolder(oRecip,
> olFolderInbox)
> Else
> MsgBox "No Mailbox"
> End If
>
> Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> Set SubFolder = otherInbox.Folders("Flash Recieved")
>
> thank you again your time is greatly appreciated
(Msg. 7) Posted: Wed Jul 02, 2008 9:50 am
Post subject: Re: changing locating inbox Via VB HELP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
ken you star you were right all along it was me and my stupidity!!!! i am
looking for folders that are inside my inbox however i had the folders on the
outside! lol sorry Ken thanks very much for you help. greatly apreciated
"Ken Slovak - [MVP - Outlook]" wrote:
> Is "Main" the name of that mailbox you want to log into? You need to use the
> actual name of the user who owns that mailbox, for example for me on my
> Exchange server it would be "Ken Slovak".
>
> What line fires the error? Put your cursor in the code and set a breakpoint
> on the Set ns = GetNameSpace("MAPI") line. When you hit the breakpoint step
> the code (F until you get to the line that fires the error.
>
> You also need to make sure that the permissions of the logon that's running
> this code are set so that logon has permissions to log into the mailbox, the
> Inbox there and the "Flash Received" folder under that Inbox.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com > Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm >
>
> "Rivers" <Rivers.DeleteThis@discussions.microsoft.com> wrote in message
> news:829E0130-AAA7-4488-B501-5F4E6842829C@microsoft.com...
> > Hi Ken im sorry for sounding like a total noob but outlook classess and
> > methods are alien to myself ive tried to incorperate your code within the
> > new
> > code and it gives me an error "Object could not be found" can you please
> > point out where im going wrong. the code is as follows
> >
> > Dim ns As NameSpace
> > Dim Inbox As MAPIFolder
> > Dim SubFolder As MAPIFolder
> > Dim Item As Object
> > Dim Atmt As Attachment
> > Dim FileName As String
> > Dim i As Integer
> > Dim varResponse As VbMsgBoxResult
> > Dim oRecip As Outlook.Recipient
> >
> > Dim otherInbox As Outlook.MAPIFolder
> > Set ns = GetNamespace("MAPI")
> > Set oRecip = ns.CreateRecipient("Main")
> >
> > If oRecip.Resolve() Then
> >
> > Set otherInbox = ns.GetSharedDefaultFolder(oRecip,
> > olFolderInbox)
> > Else
> > MsgBox "No Mailbox"
> > End If
> >
> > Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> > Set SubFolder = otherInbox.Folders("Flash Recieved")
> >
> > thank you again your time is greatly appreciated
>
>
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum