PDA

View Full Version : Sleeper: Dr J's Progress Bar problem



gibbo1715
09-06-2005, 05:45 AM
I ve tried to add the code from Jakes (Dr J's) progress bar to my code, can anyone tell me why the below will not work?


Sub FindTextString()
Dim i As Integer
Dim szSearchWord As Variant
Dim ThisPath As String
Dim ThisName As String
Dim Savename As String
Dim sFollder As String
Dim Total1 As Long
Dim Total2 As Long
Dim x As Long
Dim y As Long
Dim MyTimer As Double
Dim NodeFullPath As String
Dim nod As Node
Dim MyPath, NodeName, parent As String
Dim n, k As Integer
Total1 = 20
Total2 = 1000
sFollder = GetFolderPath
If sFollder <> vbNullString Then MsgBox sFollder
ThisPath = ThisWorkbook.Path
ThisName = ThisWorkbook.Name
Savename = ThisPath & "\" & ThisName
szSearchWord = Application.InputBox("What are you looking for ?", "Search", , 100, 100, , , 2)
If szSearchWord = False Then
Sheets("Sheet1").Select
End
End If
With Application.FileSearch
.NewSearch
' For x = 1 To Total1
' For y = 1 To Total2
' MyTimer = Timer
' Me.TextBox4.Width = (y / Total2) * 200
' Me.Label2.Caption = "Calculating Data: " & y & " of " & Total2
.LookIn = sFollder
.FileType = msoFileTypeAllFiles
.SearchSubFolders = True
.TextOrProperty = szSearchWord
.Execute
' Next y
' ProgressBar.TextBox2.Width = (x / Total1) * 200
' ProgressBar.Label1.Caption = "Updating: " & x & " of " & Total1
' Next x
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
End With


Cheers

Gibbo

mark007
09-06-2005, 07:25 AM
What's not working? Could you be more specific?

One thing that stands out is that the progress bar code is commented out...

gibbo1715
09-06-2005, 07:32 AM
Thanks for the reply, i coded out the progress bar code due to it not working, the problem is that when i include the progress bar code it doesnt show any progress and seems to crash the macro

Jacob Hilderbrand
09-06-2005, 10:12 AM
The code must be in the user form code section and not in a module. Can you post an attachment?

gibbo1715
09-06-2005, 10:42 AM
Sorry Jake tried posting an attachement but pressing the button just froze my computer, the code above is on a userform where i have three buttons and a treeview. this thread has a previous attachement of the code to create the treeview.

http://www.vbaexpress.com/forum/showthread.php?t=4943

I will try to post the spreadsheet with where im at here if i can but if you can get it working with a previous version I will be able to copy it across

Thanks for the help Jake

Gibbo

gibbo1715
09-06-2005, 10:51 AM
Managed to get the attachement working (Not the progress bar), heres the attachement