PDA

View Full Version : Progress bar code help



sujittalukde
08-09-2007, 10:48 PM
I am using the following code to import data from web site. I want to use progress bar but not succeding to incorporate the same with my code. Can some one please help me in this matter. The code I am using is as follows:


Sub ImportData()
ActiveSheet.Unprotect Password:=""
Dim sTS As String

sTS = Range("B1").Value
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://money.rediff.com/money/jsp/co_results_q.jsp?companyCode=" _
& sTS, Destination:=Range("A3"))
.Name = "money/jsp/co_results_q.jsp?companyCode=" & sTS
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "11,13,14,15"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://money.rediff.com/money/jsp/balancesheet.jsp?companyCode=" _
& sTS, Destination:=Range("A50"))
.Name = "money/jsp/balancesheet.jsp?companyCode=" & sTS
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "10,11"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://money.rediff.com/money/jsp/ratio.jsp?companyCode=" _
& sTS, Destination:=Range("A95"))
.Name = "money/jsp/ratio.jsp?companyCode=" & sTS
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "10,11"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveSheet.Protect Password:=""
End Sub


THe WB related to progress bar is attached with this post which I have downloaded from a site.

Bob Phillips
08-10-2007, 01:39 AM
Quite honestly, this is not a good job for a PB, as the work is handed off to the web server, so your PB will not be able to get interrupts to update.