Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Outlook_VB_Help said:Open Statement
Enables input/output (I/O) to a file.
Syntax
Open pathname For mode [Access access] [lock] As [#]filenumber [Len=reclength]
The Open statement syntax has these parts:
Part Description
pathname Required. String expression that specifies a file name — may include directory or folder, and drive.
mode Required. Keyword specifying the file mode: Append, Binary, Input, Output, or Random. If unspecified, the file is opened for Random access.
access Optional. Keyword specifying the operations permitted on the open file: Read, Write, or Read Write.
lock Optional. Keyword specifying the operations restricted on the open file by other processes: Shared, Lock Read, Lock Write, and Lock Read Write.
filenumber Required. A valid file number in the range 1 to 511, inclusive. Use the FreeFile function to obtain the next available file number.
reclength Optional. Number less than or equal to 32,767 (bytes). For files opened for random access, this value is the record length. For sequential files, this value is the number of characters buffered.
Remarks
You must open a file before any I/O operation can be performed on it. Open allocates a buffer for I/O to the file and determines the mode of access to use with the buffer.
If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes.
If the file is already opened by another process and the specified type of access is not allowed, the Open operation fails and an error occurs.
The Len clause is ignored if mode is Binary.
Important In Binary, Input, and Random modes, you can open a file using a different file number without first closing the file. In Append and Output modes, you must close a file before opening it with a different file number.
Public Sub Sample()
Dim MyText As String
Dim MyData As New DataObject
Set MyData = New DataObject
MyText = "<Replace this with your text>"
MyData.SetText MyText
MyData.PutInClipboard
AppActivate ("TE.txt") 'This is the open notepad window, where I would like the text to be inserted.
MyData.getText 'This does not insert the text "<Replace this with your text>". Like it doesn't do anything... Maybe I have to use some other code?
DoEvents
End Sub
Public Sub Sample()
Dim MyText As String
Dim a as Integer
MyText = "<Replace this with your text>"
MyData.SetText MyText
a = FreeFile
Open "C:\test.txt" for output as a
Print #a, MyText
Close a
Shell "notepad.exe C:\test.txt"
End Sub
Public Sub Sample2()
Dim MyText As String
Dim a As Integer
MyText = "Yadda yadda yadda"
a = FreeFile
Open "C:\test.txt" For [b]Append[/b] As a
Print #a, MyText
Close a
Shell "notepad.exe C:\test.txt"
End Sub
Open "C:\test.txt" For Append As a
Set Wrd = GetApplication("Word.Application")
Open blabla For [b]Append[/b]
Dim MyData As New DataObject
Set MyData = New DataObject
dim Insertthistext as string
Insertthistext = "Hello"
MyData.SetText Insertthistext
MyData.PutInClipboard
AppActivate ("Map Network Drive")
SendKeys ("^v"), True