ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy query table data (https://www.excelbanter.com/excel-programming/420924-copy-query-table-data.html)

namenorg

copy query table data
 
when i run the following macro i get the data from the website, but when i
try to copy it to another location i get the following: "ExternalData_55:
Getting Data €¦"

how can i get the macro to wait for the data to be imported before copying?

any help is greatly appreciated - here is macro:

Sub MacroTest1()

With
ActiveSheet.QueryTables.Add(Connection:="URL;http://www.license.state.tx.us/ABProjectRegistrationOnline/ABProjectPrintConfirmationGeneral.aspx?strWhereURL =ABDataSearch&strProjNum=EABPRJA8800466", Destination:=Range("a1"))
.WebFormatting = xlNone
.WebSelectionType = xlSpecifiedTables
.WebTables = "5"
.Refresh
End With
Range("a1").Copy
Range("b1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

End Sub




PAL

copy query table data
 
simply, you can use a " Wait " function

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime


"namenorg" δΎ†ε‡½οΌš

when i run the following macro i get the data from the website, but when i
try to copy it to another location i get the following: "ExternalData_55:
Getting Data €¦"

how can i get the macro to wait for the data to be imported before copying?

any help is greatly appreciated - here is macro:

Sub MacroTest1()

With
ActiveSheet.QueryTables.Add(Connection:="URL;http://www.license.state.tx.us/ABProjectRegistrationOnline/ABProjectPrintConfirmationGeneral.aspx?strWhereURL =ABDataSearch&strProjNum=EABPRJA8800466", Destination:=Range("a1"))
.WebFormatting = xlNone
.WebSelectionType = xlSpecifiedTables
.WebTables = "5"
.Refresh
End With
Range("a1").Copy
Range("b1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

End Sub




Don Guillett

copy query table data
 
Changing to backgroundquery:=false will cure your immediate problem.
However, I suspect you have more. Contact me privately if desired

Sub MacroTest1()

With
ActiveSheet.QueryTables.Add(Connection:="URL;http://www.license.state.tx.us/ABProjectRegistrationOnline/ABProjectPrintConfirmationGeneral.aspx?strWhereURL =ABDataSearch&strProjNum=EABPRJA8800466",
Destination:=Range("a1"))
.WebFormatting = xlNone
.WebSelectionType = xlSpecifiedTables
.WebTables = "5"
'.Refresh
.Refresh BackgroundQuery:=False
End With

Range("a1").Copy Range("b1")

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"namenorg" wrote in message
...
when i run the following macro i get the data from the website, but when i
try to copy it to another location i get the following: "ExternalData_55:
Getting Data €¦"

how can i get the macro to wait for the data to be imported before
copying?

any help is greatly appreciated - here is macro:

Sub MacroTest1()

With
ActiveSheet.QueryTables.Add(Connection:="URL;http://www.license.state.tx.us/ABProjectRegistrationOnline/ABProjectPrintConfirmationGeneral.aspx?strWhereURL =ABDataSearch&strProjNum=EABPRJA8800466",
Destination:=Range("a1"))
.WebFormatting = xlNone
.WebSelectionType = xlSpecifiedTables
.WebTables = "5"
.Refresh
End With
Range("a1").Copy
Range("b1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True

End Sub






All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com