How to pass attachment from dialogbox to document

Hi,

I am stuck in the problem of passing attachment from dialogbox to document. I have tried using AppendItemValue but it keeps on giving me error “Object variable not set”.

Can anyone please advise.