Код программы слуедующий:
- Код: Выделить всё
Private Sub CommandButton1_Click()
Dim Firma As String
Dim Ty As String
Dim Diam As String
Dim Marka As String
Dim Tara As String
Dim NumbTara As String
Dim Brutto As String
Dim Netto As String
Dim Data As String
Dim TabNumber As String
Dim Shtamp As String
Dim CodeVnutr As String
Dim s As String
Dim Priznihod As String
Dim Lak As String
Dim Invnomobor As String
Dim Invnaimobor As String
Firma = InputBox("Введите название изготовителя")
Ty = InputBox("Введите ТУ")
Diam = InputBox("Введите диаметр")
Marka = InputBox("Введите марку")
Tara = InputBox("Введите тару")
NumbTara = InputBox("Введите № тары/массу")
Brutto = InputBox("Введите брутто")
Netto = InputBox("Введите нетто")
Data = InputBox("Введите дату")
TabNumber = InputBox("Введите табельный №")
Shtamp = InputBox("Введите штамп ОТК")
CodeVnutr = InputBox("Введите внутренний код")
Priznihod = InputBox("Введите признак сырья и номер хода")
Lak = InputBox("Введите номмер лака")
Invnomobor = InputBox("Введите инвентарный номмер оборудования")
Invnaimobor = InputBox("Введите инвентарное наименование оборудования")
CR_LF = Chr(13) + Chr(10)
s = "" + CR_LF
s = s + "OS" + CR_LF
s = s + "Q240,16" + CR_LF
s = s + "q500,15" + CR_LF
s = s + "I8,10,001" + CR_LF
s = s + "N" + CR_LF
s = s + "B470,108,2,1,2,2,90,N," + Chr(34) + CodeVnutr + Chr(34) + CR_LF
s = s + "B260,240,2,E30,2,1,42,B," + Chr(34) + Shtamp + Chr(34) + CR_LF
s = s + "A380,498,2,2,1,2,N," + Chr(34) + Firma + Chr(34) + CR_LF
s = s + "A470,420,2,1,1,2,N," + Chr(34) + Ty + Chr(34) + CR_LF
s = s + "A470,360,2,1,1,2,N," + Chr(34) + Diam + Chr(34) + CR_LF
s = s + "A350,155,2,1,1,2,N," + Chr(34) + Invnaimobor + Chr(34) + CR_LF
s = s + "A150,155,2,1,1,2,N," + Chr(34) + Priznihod + Chr(34) + CR_LF
s = s + "A170,90,2,1,2,3,N," + Chr(34) + Lak + Chr(34) + CR_LF
s = s + "A306,355,2,1,1,2,N," + Chr(34) + Marka + Chr(34) + CR_LF
s = s + "A140,355,2,1,1,2,N," + Chr(34) + Tara + Chr(34) + CR_LF
s = s + "A470,287,2,1,1,2,N," + Chr(34) + NumbTara + Chr(34) + CR_LF
s = s + "A300,288,2,1,1,2,N," + Chr(34) + Brutto + Chr(34) + CR_LF
s = s + "A125,288,2,1,1,2,N," + Chr(34) + Netto + Chr(34) + CR_LF
s = s + "A470,220,2,1,1,2,N," + Chr(34) + Data + Chr(34) + CR_LF
s = s + "A470,155,2,1,1,2,N," + Chr(34) + Invnomobor + Chr(34) + CR_LF
s = s + "A340,220,2,1,1,2,N," + Chr(34) + TabNumber + Chr(34) + CR_LF
s = s + "GG150,108," + Chr(34) + "gk_h" + Chr(34) + CR_LF
s = s + "GG100,430," + Chr(34) + "stb_h" + Chr(34) + CR_LF
s = s + "P1" + CR_LF + Chr(26)
Documents.Add
Selection.WholeStory
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=s
Selection.WholeStory
Selection.Font.Name = "Courier New"
ChangeFileOpenDirectory "D:\Взвешивание\"
ActiveDocument.SaveAs FileName:="OS.txt", FileFormat:=wdFormatDOSText, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
Open "D:\Взвешивание\OS.txt" For Input As #1
Do Until EOF(1)
Line Input #1, peremen
si = si + peremen + Chr(13) + Chr(10)
Loop
Open "LPT1:" For Binary As #2
Put #2, , si
Close #1
Close #2
'Windows("OS").Activate
' ActiveWindow.Close
'Windows("Взвешивание готовой продукции.").Activate
End Sub
Буду очень благодарен хоть за какую-либо помощь.