因為做專案臨時用到vb做界面,可以前有沒接觸過編程,所以大部分是看別人的代碼的
Dim x As Integer
Private Sub Command3_Click()
x = Val(Text1.Text)
FileCopy "C:\Users\zh\Desktop\simple_beam.txt", "C:\Users\zh\Desktop\simple_beam1.txt"
Dim buffer As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile("C:\Users\zh\Desktop\simple_beam.txt", 1)
Set b = fs.createTextFile("C:\Users\zh\Desktop\simple_beam.tmp")
Do While a.AtEndOfStream <> True
retstring = a.ReadLine
If retstring = " origin=(20, 20), width=150, height=120)" Then
b.writeline (" origin=(20, 20), width=150, height=x")’這里的x我想設定成text1中輸入的值,但設定不成功,加(“”)又會提示錯誤,大佬們這是怎么回事
Else
b.writeline retstring
End If
Loop
a.Close
b.Close
fs.copyfile "C:\Users\zh\Desktop\simple_beam.tmp", "C:\Users\zh\Desktop\simple_beam.txt", True
fs.deletefile "C:\Users\zh\Desktop\simple_beam.tmp"
Name "C:\Users\zh\Desktop\simple_beam.txt" As "C:\Users\zh\Desktop\simple_beam.py"
Name "C:\Users\zh\Desktop\simple_beam1.txt" As "C:\Users\zh\Desktop\simple_beam.txt"
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/23430.html
標籤:VB基礎類
下一篇:求助大神VBA資料篩選問題
