1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Dim Ratio As Integer
Dim Pole As Integer
Dim Nom As String
Function asc2hex(ByVal StrName As String) As String
Dim loopCount As Integer, strHold As String
For loopCount = 1 To Len(StrName)
strHold = strHold & Hex(Asc(Mid(StrName, loopCount, 1)))
Next loopCount
asc2hex = strHold
End Function
Public Function hex2asc(ByVal str As String) As String
Dim p As Integer
For p = 1 To Len(str) Step 2
hex2asc = hex2asc & Chr(CInt("&H" & Mid(str, p, 2)))
Next p
End Function
Private Sub CommandButton1_Click()
Range("A1").Select
ActiveCell.FormulaR1C1 = "2121204E69636874204265617262656974656E202D2D2D2D20446F204E6F742045646974202121"
Range("A2").Select
ActiveCell.FormulaR1C1 = hex2asc("2121204E69636874204265617262656974656E202D2D2D2D20446F204E6F742045646974202121" & "0D0D0A")
Sheets("PLC").Copy
CHEMIN_D_ACCES = "C:\Users\Germain\Desktop\"
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:=CHEMIN_D_ACCES & "PLC_" & [C7].Value & ".sbt", FileFormat:=xlText, CreateBackup:=False
End Sub |