# About win32ole problem

**URL:** <https://www.ruby-forum.com/t/about-win32ole-problem/132733>\
**Category:** Ruby\
**Created:** [March 24, 2008, 7:26am UTC](https://www.ruby-forum.com/t/about-win32ole-problem/132733 "2008-03-24T07:26:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernzhang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e4f/32.png) [@kernzhang](https://www.ruby-forum.com/u/kernzhang)\
**Post date:** [March 24, 2008, 7:26am UTC](https://www.ruby-forum.com/t/about-win32ole-problem/132733/1 "2008-03-24T07:26:16Z")

</div>

I use win32ole function call testdirector client api in ruby.system show  
error,but it’s correct when i use the same function in vbscripts.please  
help me check it!Thanks a Lot!

[vbscripts]  
Private Function SendAttachment(item,attfile)  
Set bgf=td.BugFactory  
Set bg=bgf.item(item)  
Set attf=bg.Attachments  
Set att=attf.AddItem(Null)  
att.FileName= attfile  
'att.FileSize=359  
att.Type=1  
att.Post  
End Function

[ruby]  
def addAttachment(id,file1)  
bugfactory=@td.BugFactory  
mybug=bugfactory.item(id)  
attf=mybug.Attachments  
att=attf.AddItem(nil)  
att.invoke(‘FileName’,‘d:\tmp\ruby.txt’)  
att.Description=“zhangb”  
mybug.post  
end  
when ruby call attf.AddItem(nil),system show the error  
AddItem  
OLE error code:80070057 in   
  
HRESULT error code:0x80020009  
å‘ç”Ÿæ„å¤–ã€‚

TestDirector API introduce

FUNC DISPATCH AddItem  
Dispatch ID : 3  
DESCRIPTION : Create new item object in TD Project DB  
arg1 - VARIANT ItemData []

---

<div class="post-metadata">

**Author:** ![kernzhang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e4f/32.png) [@kernzhang](https://www.ruby-forum.com/u/kernzhang)\
**Post date:** [May 18, 2008, 1:37am UTC](https://www.ruby-forum.com/t/about-win32ole-problem/132733/2 "2008-05-18T01:37:45Z")

</div>

> ```
> att=attf.AddItem(nil)
> 
> ```

I am eagerly awaiting an answer or an update, since I have a problem  
with ADO objects and nils.

I suspect that would be the only thing holding you up; If you try to  
make that item something other than nil you might find it work.

Ger.
