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
-
You are using C# and why do you want to use VBA to the latter part? Why not do all in C#? Can you describe a bit more what you are really trying to do here? :)bonCodigo– bonCodigo2013-01-16 21:09:05 +00:00Commented Jan 16, 2013 at 21:09
-
@bonCodigo - I suspect the user1984867 does not have a choice: most likely the client app is an Excel spreadsheet that pulls down data and displays it. Often developers don't have a choice over the technologies they use - that choice is made by the business or is made for them by other constraints.Phil Whittington– Phil Whittington2016-05-16 09:12:42 +00:00Commented May 16, 2016 at 9:12
Add a comment
|
2 Answers
open "output.bin" for binary access write as #1
lWritePos=1
put #1, lWritePos, vData
close #1
http://www.visualbasic.happycodings.com/Files_Directories_Drives/code52.html
1 Comment
user2192333
See my answer (which should have been a comment to this post) below
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.
1 Comment
AntoineL
It would have helped to explain why there is such a need. Right now, we can only guess, or perhaps have educated guesses.