progress bar
-
Hey all: I have written a code that will export my data from Datagrids to Excel. It is taking sometime to write the data in excel file. I thought it would be better if I could provide some visual feed back to user like in progress bar or any other when my application writes data in Excel. Can any body help me how to set the inteval and how can know that excel application is opened from the code? Others type of suggestions for achieving my tasks is highly appreciated.
-
Hey all: I have written a code that will export my data from Datagrids to Excel. It is taking sometime to write the data in excel file. I thought it would be better if I could provide some visual feed back to user like in progress bar or any other when my application writes data in Excel. Can any body help me how to set the inteval and how can know that excel application is opened from the code? Others type of suggestions for achieving my tasks is highly appreciated.
Hi, Don't know if this will help, But I have used this a few times in excel to show a progress in the status bar... Sub StatusProgress() ' ' Progress Application Statusbar ' Dim intIndex As Integer Dim sngPercent As Single Dim intMax As Integer intMax = 100 For intIndex = 1 To intMax sngPercent = intIndex / intMax ProgressStyle sngPercent DoEvents '------------------------ ' Your code would go here '------------------------ Sleep 100 Next Application.StatusBar = False End Sub Function ProgressStyle(Percent As Single) ' Progress Style ' Application Status bar ' Pulsing ' Dim strTemp As String Dim intIndex As Integer Dim intLen As Integer intLen = 21 intIndex = Int((Percent * 100) Mod intLen) strTemp = String(intLen, txtPg7a.Text) If intIndex > 0 Then Mid(strTemp, intIndex, 1) = txtPg7p.Text End If Application.StatusBar = "Processing " & strTemp End Function Cheers, Stefan.
All answers have a question? All code has an end.
-
Hi, Don't know if this will help, But I have used this a few times in excel to show a progress in the status bar... Sub StatusProgress() ' ' Progress Application Statusbar ' Dim intIndex As Integer Dim sngPercent As Single Dim intMax As Integer intMax = 100 For intIndex = 1 To intMax sngPercent = intIndex / intMax ProgressStyle sngPercent DoEvents '------------------------ ' Your code would go here '------------------------ Sleep 100 Next Application.StatusBar = False End Sub Function ProgressStyle(Percent As Single) ' Progress Style ' Application Status bar ' Pulsing ' Dim strTemp As String Dim intIndex As Integer Dim intLen As Integer intLen = 21 intIndex = Int((Percent * 100) Mod intLen) strTemp = String(intLen, txtPg7a.Text) If intIndex > 0 Then Mid(strTemp, intIndex, 1) = txtPg7p.Text End If Application.StatusBar = "Processing " & strTemp End Function Cheers, Stefan.
All answers have a question? All code has an end.
-
Opps, Adjustments to above code... Replace 'txtPg7a.Text' with "o" and replace 'txtPg7p.Text' with "•" Sorry.. Cheers, Stefan.
All answers have a question? All code has an end.
-
Hey I repalced whatever you have told me but I still get some compile errror? What exactly o and . are doing? and it also gave me some erros on other parts of code. Is the code written in VB.NET?
Hey, Sorry forgot to declare 'Sleep' Place this at the top of your module
Option Explicit Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long
) The "o" and "." are use to show a progress in the status bar, the "." runs along the "o" to give you the progress. Hope this helps. Cheers. Was written in Visual basic"All answers have a question? All code has an end."