views:

437

answers:

3

CDO works fine in Access VBA for me except when I try to use UNC paths for the attachments. According to MSDN documentation on CDO, AddAttachment should allow UNC paths. Here's what I think should work, but doesn't:

msg1.AddAttachment "\\serv.dom.local\path with spacesh1\file.xls"

It works perfectly fine if I use "C:...". What's the correct format?

The error I get is -2147024894 (80070002). "The system cannot find the file specified"

UPDATE: I gave up and created (or copied) the file to my local C drive rather than continue to fool with this.

A: 

Have you tried to just use the server name.

i.e.

msg1.AddAttachment "\\servername\path with spacesh1\file.xls"
Mark3308
Yes, I've tried that :(
Knox
The point is that you need an SMB server name, not a DNS server name. Does it work with the IP address?
David-W-Fenton
sorry, David - I didn't get a chance to try the IP. But what's the difference between a SMB name and a UNC using DNS?
Knox
A: 

Does the user that runs the COM ActiveX has permissions to access that share?

Rodrigo
I gave up on this issue, so no longer want to go back to the environment to try this. But since I was developing and testing under the same user name; I'm pretty sure that wasn't the problem.
Knox
A: 

The UNC format should be: \\servername\sharename\path\filename

Whichever user runs the program would have to have permissions for the sharename

Eric