如何从 Microsoft Access 与 Visual Basic 建立网络连接?
我们在 Microsoft Access 中有一个 Visual Basic 应用程序,我们需要建立网络连接。 对于 VB6,有一个名为 WinSock 的方便的小控件使这成为可能,但我找不到 Microsoft Access 内部存在的精简 VB 版本的任何类似内容。 有任何想法吗?
由于我没有得到任何答案,我将尽力澄清我需要这个的目的。
我的应用程序发送一封电子邮件,我们当前正在使用内置 Outlook 对象来创建消息并在后台发送。 缺点是它会提示用户批准“外部程序”发送电子邮件,这让我们的用户感到沮丧,而且似乎没有必要。 我在网上找到的所有其他电子邮件选项都要求我们下载或购买控件,这对于我们部署给所有用户来说过于劳力密集。
我希望使用套接字控件手动连接到 SMTP 服务器并发送消息(因为这在其他语言中很简单),但我找不到任何方法在 VBA 中建立 TCP 连接。
We have a Visual Basic application inside of Microsoft Access and we need to make a network connection. With VB6, there was a handy little control called WinSock that made this possible, but I can't find anything similar for the stripped down VB version that exists inside of Microsoft Access. Any ideas?
Since I'm not getting any answers, I'll try to clarify what I need this for.
My application sends out an email, and we're currently using a built-in Outlook object to create a message and send it in the background. The drawback is that it prompts the user to approve an "outside program" to send an email, which is frustrating our users and seems unnecessary. All of the other emailing options I've been able to find online require us to either download or purchase a control, which would be too labor intensive for us to deploy to all of our users.
I was hoping to use a socket control to manually connect to the SMTP server and send a message (since this is trivial in other languages) but I can't find any way to make a TCP connection in VBA.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我上个月刚刚处理过这个问题。 由于种种原因,CDO还不够充分,直接使用MAPI的方式过于复杂,而且你所抱怨的Outlook提示完全无法接受。
我最终使用了 Outlook 兑换。 它被 Access 开发人员广泛使用,尽管我发现它相当复杂并且没有很好的文档记录。 但它做得很好。
I just dealt with this very issue in the last month. For various reasons, CDO was not adequate, direct use of MAPI way too complex, and the Outlook prompt you complain about completely unacceptable.
I ended up using Outlook Redemption. It's widely used by Access developers, though I found it to be rather convoluted and not terribly well-documented. But it is doing the job quite well.
微软添加的电子邮件“安全”功能让很多开发者感到沮丧。 我不知道有什么优雅的解决方案。 我已经成功地使用了免费软件应用程序 ClickYes Express,但这当然不是您寻求的答案。
The email "security" feature added by Microsoft has frustrated many developers. I don't know of an elegant solution. I've used the freeware app ClickYes Express with success, but of course that's not the answer you seek.
对于OP中提到的具体问题,有更好的解决方案。 将邮件“保存”到 Outlook。 不要“发送”它。 它使用户可以明确控制发送内容和发送时间,并且不会生成弹出对话框。 三赢。
但既然你问了……
这是 TCP 代码,而不是电子邮件代码。 它还包括 OSX VBA TCP 代码,我之前没有发布过。
For the specific problem mentioned in the OP, there is a better solution. 'save' mail to Outlook. Do not 'send' it. It gives the user explicit control over what is sent, and when, and does not generate pop-up dialogs. A triple win.
But since you ask....
This is TCP code, not email code. It's also includes OSX VBA TCP code, which I have not previously published.