Items.Add doesn't add to the folder I want

  • Thread starter Thread starter Michael.Kensy
  • Start date Start date
M

Michael.Kensy

Hi again,

I must be stupid ... why doesn't following code add strTag-Item into
strParameter-Folder

***
Set Application.ActiveExplorer.CurrentFolder =
Application.GetNamespace("MAPI").GetFolderFromID(strParameter)
Set objNewItem =
Application.ActiveExplorer.CurrentFolder.Items.Add(strTag)
objNewItem.Display
***

going throug this lines CurrentFolder of the ActiveExplorer is always set to
the folder I want ... but folder (also FullFolderPath) of objNewItem will be
set to the one which has been activated b e f o r e running the code.
Whats wrong with it?

thanx again
michael
 
I think you make things more complicated than they actually are. Why not
use:
Set objNewItem =
Application.GetNamespace("MAPI").GetFolderFromID(strParameter).Items.Add(str
Tag)
I take for granted that the rest of your code is right and that you have a
valid folderID and that strTag has a meaningfull content. It's not easy to
debug out of a fragment of code.


--


Kindest regards
HC Francke
www.master-office.com
 
Hi Hans-Christian,

Hans-Christian Francke said:
I think you make things more complicated than they actually are. Why
not use:
Set objNewItem =
Application.GetNamespace("MAPI").GetFolderFromID(strParameter).Items.Add(str
Tag)

it works you are absolutely right ...

but what (the hell *smile*) is wrong with my code?
***
Set Application.ActiveExplorer.CurrentFolder =
Application.GetNamespace("MAPI").GetFolderFromID(strParameter)
Set objNewItem = Application.ActiveExplorer.CurrentFolder.Items.Add(strTag)
objNewItem.Display
***
Why isn't it possible to reference at the current folder when I do Set
CurrentFolder to the folder I need?
I take for granted that the rest of your code is right and that you
have a valid folderID and that strTag has a meaningfull content. It's
not easy to debug out of a fragment of code.

rest of my code works ... may be it 's also more complicated than it must be
....

thanx again
michael
 
Back
Top