DOT and TXT Open!

Open a new Worddokument based on a DOT. Open several (Multiselect=True) text files with Notepad - CTRL key hold and files select. Harddrive and path are adjusted before. The files at the end of the article are Excelfiles of the version 2003 and 2007.

The following code belonged In "Module1"

Option Explicit
Public Sub Open_DOT()
Dim varFile As Variant
Dim dblTMP As Double
varFile = Application.GetOpenFilename _
("DOT Files (*.dot), *.dot")
If varFile = False Then Exit Sub
dblTMP = Shell("""winword.exe""" & " /t" & varFile, 3)
End Sub
Public Sub Open_TXT()
Dim intNumber As Integer
Dim varFile As Variant
Dim dblTMP As Double
ChDrive ("E") 'adapt
ChDir ("E:\Excel") 'adapt
varFile = Application.GetOpenFilename _
("TXT Files (*.txt), *.txt", , , , True)
If Not IsArray(varFile) Then Exit Sub
For intNumber = Lbound(varFile) To Ubound(varFile)
dblTMP = Shell("""notepad.exe""" & _
" " & varFile(intNumber), 3)
Next intNumber
End Sub

Sample 2003

Sample 2007


Beliebte Posts aus diesem Blog

Formeln - auch Array - per VBA eintragen...

Alle Dateien eines Ordners - Optional mit Unterordner

Excel -> Word in Textmarken (Bookmarks)...