
Private Sub CommandButton1_Click()
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
Dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If Dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(Dove))
.Name = FileDaAprire
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierSingleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Sub miofile()
FileDaAprire = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If FileDaAprire = False Then Exit Sub
Dove = InputBox("SCRIVI L'INDIRIZZO DELLA CELLA DA DOVE INIZIARE A IMPORTARE")
If Dove = "" Then Exit Sub
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileDaAprire & "", Destination:=Range(Dove))
.Name = FileDaAprire
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierSingleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = True
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
|
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub apri_file_word()
On Error Resume Next
FILEWORD = Application.GetOpenFilename("WORD FILES (*.DOC), *.DOC", , "SELEZIONA IL FILE WORD DA APRIRE")
If FILEWORD = False Then Exit Sub
Dim X As Long
X = ShellExecute(0, "OPEN", FILEWORD, "", "", 1)
End Sub
|
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub apri_file_word() On Error Resume Next FILEWORD = "C:PIPPO.DOC" Dim X As Long X = ShellExecute(0, "OPEN", FILEWORD, "", "", 1) End Sub |
