vba 如何在VBA中将字节数组保存到文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14366033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 19:12:35  来源:igfitidea点击:

How to save a byte array to a file in VBA

vba

提问by user1984867

I am trying to download files from the server.I have VBA code which makes a call to a C# web service and gets an array of bytes..I am now trying to figure out,how can I write the byte array to a file on my local machine through VBA code

我正在尝试从服务器下载文件。我有 VBA 代码,它调用 C# Web 服务并获取字节数组。我现在想弄清楚,如何将字节数组写入文件我的本地机器通过 VBA 代码

回答by gbronner

回答by user2192333

vData needs to be defined as Dim vData() as byte. The decodeBase64 function which converts the (image) encoded string (link to it in this answer) returns a byte array and if it is passed back to a variant, the resulting data file will not open.

vData 需要定义为Dim vData() as byte. decodeBase64 函数转换(图像)编码的字符串(在这个答案中链接到它)返回一个字节数组,如果它被传递回一个变体,生成的数据文件将不会打开。