Home > Software engineering >  Open vb desktop 123. TXT
Open vb desktop 123. TXT

Time:09-26

Vb how to open the desktop 123. TXT, predecessors, consult

CodePudding user response:

 Private Sub Command1_Click () 
AA="123456"
Open "C: \ Users \ \ Administrator \ Desktop \ 123. TXT" For the Output As the # 1
The Write # 1, AA
Close # 1
'in the Desktop to create 123. TXT file, C: \ Users \ Administrator \ Desktop \ is W7 Desktop path, if the file does not exist, the Output method can create a file
End Sub

Private Sub Command2_Click ()
Open "C: \ Users \ \ Administrator \ Desktop \ 123. TXT" For Input As # 1
Input # 1, BB
Close # 1
'the Input method is to read the file content
End Sub

CodePudding user response:

First in engineering a reference to the selected Windows Scripting Host Object Model

The button code so write
 

Dim desk As New WshShell
S=desk. SpecialFolders (" desktop ")
The Open s&" \ 123. TXT "For Input As # 1
Input # 1, you need to Input the content of the TXT
Close # 1


This is ok
  • Related