startuga
05-06-2014, 07:55 AM
Hi guys,
I have an array () and 8 textbox (always 8)
what im trying to do is making
tetxbox1 get value from array in position (1)
tetxbox2 get value from array in position (2)
.
.
.
.
.
While the array are being filled.
My code:
Dim filepath() As String
Private Sub CommandButton4_Click()
Const msoFileDialogOpen = 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWord = CreateObject("Word.Application")
Set WshShell = CreateObject("WScript.Shell")
strInitialPath = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Desktop\"
objWord.ChangeFileOpenDirectory (strInitialPath)
With objWord.FileDialog(msoFileDialogOpen)
.Title = "Select the file to process"
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "All Files", "*.*"
.Filters.Add "Excel Files", "*.xls;*.xlsx"
.Filters.Add "Text Files", "*.txt"
.Filters.Add "Various Files", "*.xls;*.doc;*.vbs"
If .Show = -1 Then
Dim num As Integer
On Error Resume Next
num = UBound(filepath)
On Error GoTo 0
ReDim Preserve filepath(num + .SelectedItems.Count)
For Each file In .SelectedItems
Set objFile = fso.GetFile(file)
num = num + 1
filepath(num) = objFile
TextBox14.Text = num & (" - Ficheiro(s) Adicionado(s)")
Next
Else
End If
End With
End Sub
Someone can help or give me some lights pls?
Thanks,
Daniel
I have an array () and 8 textbox (always 8)
what im trying to do is making
tetxbox1 get value from array in position (1)
tetxbox2 get value from array in position (2)
.
.
.
.
.
While the array are being filled.
My code:
Dim filepath() As String
Private Sub CommandButton4_Click()
Const msoFileDialogOpen = 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWord = CreateObject("Word.Application")
Set WshShell = CreateObject("WScript.Shell")
strInitialPath = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Desktop\"
objWord.ChangeFileOpenDirectory (strInitialPath)
With objWord.FileDialog(msoFileDialogOpen)
.Title = "Select the file to process"
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "All Files", "*.*"
.Filters.Add "Excel Files", "*.xls;*.xlsx"
.Filters.Add "Text Files", "*.txt"
.Filters.Add "Various Files", "*.xls;*.doc;*.vbs"
If .Show = -1 Then
Dim num As Integer
On Error Resume Next
num = UBound(filepath)
On Error GoTo 0
ReDim Preserve filepath(num + .SelectedItems.Count)
For Each file In .SelectedItems
Set objFile = fso.GetFile(file)
num = num + 1
filepath(num) = objFile
TextBox14.Text = num & (" - Ficheiro(s) Adicionado(s)")
Next
Else
End If
End With
End Sub
Someone can help or give me some lights pls?
Thanks,
Daniel