I'm using a macro to create a CNC program.
To create the ".spf" file the machine is using I use:
Dim m2_path as string
m2_path = T:\Production\Cavity-Line\Eric R\Excel\PARAMETER.spf
Dim text as string
text = 'my data
Dim fso As Object
Dim Fileout As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fileout = fso.CreateTextFile(m2_path, True, True)
Fileout.Write text
Fileout.Close
When I try to open the program on the machine I get a error "Cannot open binary files".
But If I manually copy the content from the "m2_path"-file into another one and then try to open it, I don't get the error message.
Is there something wrong with the formatting of the text file?
Machine is using SINUMERIK 840d sl.
Thanks in advance
Regards
EDIT:
Thanks to @ashleedawg
Good to hear you had success with the change:
From :
Set Fileout = fso.CreateTextFile(m2_path, True, True)
to :
Set Fileout = fso.CreateTextFile(m2_path, True, False)
to create a ASCII file instead of Unicode (which could not be read by the machine).
Reference: Siemens SINUMERIK 840D sl CNC Software 2.6 SP1 HF4 Installation/Operating Manual, Page 29
Text files can be edited using the SINUMERIK Operate Editor if the text files use the LF character (0aH) or the character string CRLF (0d0aH) as line or end of block identifier. The editor cannot open binary files. ... Files that are newly generated from the SINUMERIK Operate Editor are UTF-8-coded - and have the LF characters as end of block identifier. For UTF-8-coded files, all special characters are correctly displayed. When opening files, the SINUMERIK Operate Editor assumes that the files are UTF-8-coded. If files with another coding are opened, e.g. with Windows page coding, then the special characters are only correctly displayed if the SINUMERIK Operate was changed over to the appropriate system language. This also involves e.g. files that were generated using the HMI-Advanced Editor. When opening with the SINUMERIK Operate Editor, the coding of such files is not changed. There is no automatic conversion into UTF-8-coding. If files we re generated or processed with an external editor (e.g. Notepad under Windows) and not the SINUMERIK Operate Editor, then it should be noted that the file is saved, UTF-8-coded. When using Notepad, and when saving the file as encoding select "UTF-8" in the “Save As” dialog box. If special characters are not being used, then "ANSI" can also be specified as encoding.