Excel VBA 跨域文件复制

发布于 2024-10-26 14:31:50 字数 423 浏览 2 评论 0原文

这是一个与我之前的问题几乎相似的问题,但是我之前的问题是在 VB.NET 中,现在我需要在 Excel VBA 中执行相同的操作。

基本上,我有一个在 Windows 域中的服务器上自动生成的文件,例如,称为“prod”,我需要使用 VBA 将该文件传输到另一个 Windows 域中的另一台服务器,例如“QA” ,其中 QA 和 Prod 完全具有不同的凭据,每次打开目标文件夹时我都必须验证该凭据。

因此,我想常规的文件复制方法行不通,是否有其他方法可以实现此目的?

谢谢!

PS 这是我上一个问题的链接,不确定是否有帮助:

交叉使用VB.NET复制域文件

Here is a question that is almost similar to my previous question here, however my previous question was in VB.NET and now I will need to do the same in Excel VBA.

Basically, I have a file that is being generated automatically on a server in a Windows domain, say, called, "prod" and I will need to have VBA to transmit this file to another server in another Windows domain, say, "QA", where QA and Prod have different credentials altogether and I have to authenticate that credential every time I opened up the destination folder.

Therefore, I guess the regular filecopy method would not work, is there another way where we can accomplish this?

Thanks!

P.S. Here is the link to my previous question, not sure if it would help:

Cross domain file copy using VB.NET

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静待花开 2024-11-02 14:31:50

您应该能够使用转换为 VBA 的 VB.NET 解决方案,

例如 LogonUser 函数声明类似于

Private Declare Function LogonUser Lib "advapi32.dll" _
(ByVal lpszUsername As String, _
ByVal lpszDomain As String, _
ByVal lpszPassword As String, _
ByVal dwLogonType As Integer, _
ByVal dwLogonProvider As Integer, _
phToken As IntPtr) As Boolean

you should be able to use your VB.NET solution translated to VBA

eg the LogonUser function declaration would be somethong like

Private Declare Function LogonUser Lib "advapi32.dll" _
(ByVal lpszUsername As String, _
ByVal lpszDomain As String, _
ByVal lpszPassword As String, _
ByVal dwLogonType As Integer, _
ByVal dwLogonProvider As Integer, _
phToken As IntPtr) As Boolean
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文