Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Excel ignoring legitimate code, AGAIN!

I have a VBA program that I just created to process large amounts of
ECG data that works fine except for one little UI bug. Due to the
size of the data files which can have anywhere from 180,000+ to
600,000+ data points, I included a progress bar so that the user
could see how far along the program is when it is reading the source
data file and then down-converting (reducing the high frequency data
to low frequency data). The problem is that after a few refreshes,
the screen stops updating even though the program is still running;
thus from the user’s point of view the program appears to have
stalled despite the fact that it is still working.

This is not the first time I have had issues with the screen not
refreshing properly or Excel VBA code acting as if it is not present.
The way the program is coded, the progress bar form should be
repainted for every five percent increase in the processing of the
complete data set. At first the progress bar works fine, but about 60
to 75 percent into reading data from the source file screen refreshes
just stop. When the data is read, the progress bar should reset and
inform the user that it is converting the data set, but the progress
bar form remains frozen until the form is deactivated after data
processing is completed.

Here is a sample of the code from one of the progress bar forms:
Private Sub
UpdateECGProgressBar(progressCompleted As Double)
' Update progress bar for every five percent completed.

If progressCompleted * 100 = progress Then
progress = progress + 5
lblProgressBar.Width = progressCompleted * 236
frmProcessECGData.Repaint
End If
End Sub

Private Sub AcquireECGData()
' Get BPM and ECG Data from text file created by BSL® Pro.

Dim filename As String
Dim fileHeader As String
Dim dataline As String
Dim fileNumber As Integer
Dim index As Long
Dim timeBase As Double
Dim dTime As Double

ReDim ecgSamples(1) As ECGDataType 'reset ECG data object

progress = 0
timeBase = 0#
dTime = 1 / ecgInputRate

filename = FindFilename(ecgSourceFile)
fileNumber = FreeFile

If filename < "False" Then
'set default output filenames
ecgAvgFilename = Left(filename, Len(filename) -
4) & " - avg (ECG).txt"
ecgMaxFilename = Left(filename, Len(filename) -
4) & " - max (ECG).txt"

'open source file and strip header line
Open ecgSourceFile For Input As #fileNumber
Line Input #fileNumber, fileHeader

index = 1
While Not EOF(fileNumber)
'acquire ECG data from source file
ReDim Preserve ecgSamples(index) As ECGDataType
With ecgSamples(index)
Line Input #fileNumber, dataline
.BPM = CDbl(Left(dataline, InStr(dataline,
vbTab) - 1))
.mV = CDbl(Right(dataline, Len(dataline) -
InStrRev(dataline, vbTab)))
.sampleTime = timeBase + (index - 1) * dTime
End With

'update progress bar
Call UpdateECGProgressBar(index / nECGSamples)
index = index + 1
Wend

Close #fileNumber
End If
End SubAny ideas as to why Excel is choosing to
ignore the UpdateECGProgressBar code after a certain point? By the
way, there have been times when the program has worked as expected so
it should not be an issue with the code itself so much as it is an
issue with VBA Excel executing code that is clearly there.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Geomean - Ignoring Empty Cells NC2A'DAM Excel Worksheet Functions 13 November 26th 08 03:57 PM
Finally, a legitimate Excel 2007 crash ilia Excel Discussion (Misc queries) 2 November 7th 07 04:23 PM
Excel ignoring previously entered formulas mijoh Excel Worksheet Functions 3 April 24th 07 06:38 PM
Ignoring code to shut a workbook if it is already shut Cammy Excel Discussion (Misc queries) 1 September 12th 06 06:12 PM
How can I sort text (in excel) while ignoring articles (e.g., the happy1 New Users to Excel 2 March 4th 06 03:49 AM


All times are GMT +1. The time now is 08:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"