Hello,
I have a trouble with this little subroutine in VBA (see file script attached)
I have tested it first in real VBA environment and works ok.
In MS I do get an error.
----- Macro Scheduler--------
Microsoft VBScript Compilation error: 1025
Expected end of statement
Line 37, Colum 16
VBStart
Sub WriteBin()
Dim FileName
Dim Testvar
Dim FileNo
FileName = "Q:\test.bin"
Testvar = 4
FileNo = FreeFile
Open FileName For Binary Lock Read Write As #FileNo
Put #FileNo, , Testvar
Close #FileNo
End Sub
VBEnd
Vbrun>WriteBin
- What I do wrong?
- Do you have any guideline how to vrite VBScript code?
often I have to find tricks to make it working
Thanks
Massimo
MS - Error with VBA Sub to write a binary file
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: MS - Error with VBA Sub to write a binary file
Macro Scheduler supports VBScript not VBA. The code inside a VBSTART and VBEND block needs to be VBScript not VBA - the two are very different. A major difference is that VBA has context - it sits within an application like Excel or Word and therefore knows about those apps whereas VBScript doesn't.
See:
https://help.mjtnet.com/article/19-conv ... o-vbscript
See:
https://help.mjtnet.com/article/19-conv ... o-vbscript
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: MS - Error with VBA Sub to write a binary file
ok.
thanks for the refences and explanations
massimo
thanks for the refences and explanations
massimo