User Profile
Collapse
Profile Sidebar
Collapse
Bill Mochal
Last Activity: Jan 17 '12, 09:52 PM
Joined: Nov 1 '11
Location:
-
Thanks for the suggestions - I'm still working on implementation. -
NeoPa,
Sorry for the breach of etiquette... I am restoring the best answer designation to your reply in the prior thread.
Here's the code I've been experimenting with (reduced to only ten web page queries).
The problem is that an error is generated because the code is trying to create a worksheet named "A","AAPL", etc. and that worksheet name already exists.
Code:Sub Macro8() Dim conString
Last edited by NeoPa; Jan 2 '12, 05:07 PM. Reason: Reduced blank lines to allow viewing the code without too much scrollingLeave a comment:
-
Your suggestion worked, NeoPa.
There's one issue left.
** Post edited to split the follow-up question into a separate thread - How do I Manage Worksheets Within a Workbook **Leave a comment:
-
How do I Manage Worksheets Within a Workbook
This question was split from a related thread (VBA Importing Data from Web into Excel2007).
There's one issue left.
The VBA code won't run if the workbook already contains individual sheets with the same names. If you look at the code, the first loop iteration creates a spreadsheet page named "A". If there's already a page named, "A", in the workbook, you get an error. So I've been running the VBA code...Last edited by NeoPa; Dec 22 '11, 12:28 AM. Reason: Split and amended to include link to previous thread. -
I suspect the same errors will occur if the code is re-run (after all, a page that can't be accessed, can't be accessed), but it's worth a try.
Thanks again!Leave a comment:
-
Thanks, NeoPa
Thanks, NeoPa, I will post the VBA code below. I should clarify one thing - the VBA code is only executed once as an Excel macro to initialize the queries. For subsequent data imports into Excel, I only use the "Data Refresh All" function in Excel and that is when I get those various errors.
OK, here's the code:
Code:Sub Macro4() Dim conString As String Dim conName As String
Last edited by NeoPa; Nov 12 '11, 08:35 PM. Reason: Added mandatory [CODE] tags for you, stripped much unrequired code and removed quote of preceeding postLeave a comment:
-
Bill Mochal started a topic VBA (Excel macro) Import Data From Webpage Error-handlingin Visual BasicVBA (Excel macro) Import Data From Webpage Error-handling
I have a VBA macro that imports data from a long (600+)series of web pages into an Excel 2007 workbook.
There are occasional errors each time the macro is run such as: "The Web query returned no data. To change the query... etc." or "Unable to open... etc."
When these occur, a dialouge box with an "OK" button pops up and the macro waits until I click OK.
I'm looking for a modification to... -
VBA Importing Data from Web into Excel2007
I have a VBA macro that imports data from a long (600+)series of web pages into an Excel 2007 workbook.
There are occasional errors each time the macro is run such as: "The Web query returned no data. To change the query... etc." or "Unable to open... etc."
When these occur, a dialouge box with an "OK" button pops up and the macro waits until I click OK.
I'm looking for a modification to...
No activity results to display
Show More
Leave a comment: