As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've spent hours scouring the net for anything to do with VBA calling data from the web in excel and nothing provides a tutorial on how to do so, only complicated examples un-related to what I want to do.
I want to pull data from either a .html or .xml site, doesn't matter, via Excel and find specific points in that data. I can find specific points but don't know how to get the data or scroll through multiple lines. I've done this exact sort of thing in mIRC (sort of C code).
http://eve-central.com/home/quicklook.html?typeid=438
http://api.eve-central.com/api/quicklook?typeid=438
Those are two examples, using roughly the same data I'd like to retrieve. It'd be FAR more specific with at most 100 or so different values.
I'd like to be TAUGHT how to do it, not given the code to do it, or if you must explain each part with comments in-depth please.
Edit: I'm just saying here that I don't want you to link me some random code that does something similar and expect me to modify it without an explanation. Not wanting someone to just write up a full guide of internet capability for Excel.
Thanks
Nick
Edit: I'll try explaining it again in a different sense. I play a game called EVE Online, and there's a lot of "market" databases online that allow access in this form for programs to extract data of certain items' prices. Pretty much I want to do that in an Excel document and then obviously list them in a hidden sheet or something. I don't want to have to use a secondary program, I know it's entirely possible within just Excel.
Have a look here - How can I send an HTTP POST request to a server from Excel using VBA? and getHTTP with (excel) VBA?
That deals with the code part. A note regarding the links provided, refer to the MSDN documentation regarding the WinHttp.WinHttpRequest.5.1 and MSXML2.ServerXMLHTTP to gain better clarity regarding what the these libraries are used for. I also suggested reading up a bit about using COM objects in VBA
I'd like to be TAUGHT how to do it,
not given the code to do it, or if you
must explain each part with comments
in-depth please.
Not to be rude, but this sounds to me like you want someone to teach you how to code. I dont think one can simply teach code.
Edit:
I misunderstood your question, correct me if I wrong, but the crux of your question revolves around I can find specific points but don't know how to get the data or scroll through multiple lines.
Using http://msdn.microsoft.com/en-us/library/aa163921(office.10).aspx, you would probably need to get all your result nodes into an XML object. You could then need to loop through the result set ( which I think is what you meant by scroll).
Related question: How to parse XML using vba
This is a quick and rough answer, becuase what your doing sounds a little bit dodgy(see comment), but from my understanding of Excel, I think your best bet is to use the ODBC driver and connect directly with MS Access (then export into excel) to the same database that the website is using to to receive all the data.
Which will mean that you will need:
1. both the username and password to the database.
2. the associated sql queries that the website is using to retrieve the data. (which may include joins, functions etc.)
Otherwise, you will have to get it through the "front", and you will need to write your own html parser for the section of each page to generate an xml file so that excel can read the final contents table data cleanly. (for excel 2007 and up.)
Doing so will also allow you be able to infer a column's 'data type' such as int, char, bigint etc. in the xml schema. But yeah, this might only need to be done probably in something like console C#/C++/java whatever, not in excel itself because I'm pretty sure excel doesn't have a feature that lets you write your own 'HTML to XML' parser for a website it knows nothing about.
hope this helps..
1) Copy a link to the price data you want. ie
http://api.eve-central.com/api/marketstat?typeid=34&typeid=35®ionlimit=10000002
2) In excel select the location you want the data to be imported to. Preferably a blank sheet.
3) Data -> Import External Data -> New Web Query.
4) Paste the link into the address bar. You can edit the link later on to add or subtract typeids.
5) Press the Go button.
6) Select one of the yellow arrow boxes. I chose the box directly above the line evec_api version.
7) Press the Ok button to import the data to the sheet you selected in step 2.
Now you can right click on the data to "Refresh Data".
Use whatever look up formulas to read the prices from this data to the rest of your sheet.
You can change the address of the Web Query by right clicking on any part of the data and selecting "Edit Query..."
Hope this gets you going in the right direction. This will work with Excel version 2002(XP) and 2003. Excel 2007 is more friendly to XML queries.
Related
I was wondering if anyone could help me to disable the Advanced Filter option in Excel 2013.
I have used the following to disable all other data ribbon options:
.Protect UserInterfaceOnly:=True
But advanced filter is still able to be selected. With this they can unfilter the data.
The following code used to work in older versions of Excel but I cannot seem to get it to work for Excel 2013:
Application.CommandBars("Worksheet Menu Bar").Controls _
("&Data").Controls("&Filter").Controls("&Advanced Filter...").Enabled = False
If anyone could help me out with this or point me in the right direction then it would be appreciated.
Thanks guys.
Solution Suggested
The approach will be hiding the button from the user interface: the advantage on this solution is that the code is not in VBA (entirely) so, is not that easy for the user to modify it (or know what is going on backstage).
Answer Explanation/Next steps
It's really a deep answer with many steps involved in it so, I'll just post guidance and some useful links, that way you may research about it first.
1. Download Custom UI Editor for Microsoft Office: this helps to modify the user interface for the document.
2. Look for tutorials; start to code there with something basic like adding a tab and a button, (this is a good one)
3. Back to Excel, look for life cycle and custom events, this is a good place to start
4. You'll need to catch the event when the Ribbon is loaded; in that time, you'd need to disable the button, these links (1,2) are useful to show the steps and some example workbooks for it.
5. Locate the ID for the button and disable it (Hint: The idMSO = AdvancedFilterDialog, if you 've followed the previous steps, it will make sense here-).
Further information/Answer Disclaimer
Excel is not a software that can handle security deeply; if you are trying to restrict the user somehow in the original file, you should try other approaches -IG: a copy of a workbook for reference only, while the master one is saved in a sharepoint only modifiable by people authorized for it-.
While FAQ in S.O is strict about referencing to other sites without using a proper reference for it, this is a deep step solution that would take pages to explain even a random example; appealing to the guiding topic, this answer should be ok.
I have to fix the problem in the title and after one day of research I realy don't know what else to try, what else to google ;)
The topic is discussed in an IBM TechNote.
But this answer isn't enough for me. I really need a workaround!
My question: Can I 'get between' the User clicking the 'Copy as table' and the actual copying of the table?
I see two ways of solving my problem (I don't know how to implement them):
If I just could show the user a Messagebox 'Use our own export agent' that would be great.
If I could convince Notes to just copy each document only once that would be even greater.
If I should make my question more precise, just ask. I will gladly edit it!
Every answer would be highly appreciated. Out of the box thinking, other approaches, I like to hear your opinion!
Friendly Greetings
Josi
Unfortunately there is no way to hook in and alter the results of the Copy Selected as Table method. If it is possible to show an "Export Friendly" view that is not categorized, that is one way to solve the problem.
I'm not sure how useful it will be to you, but many years ago I wrote a sample project for exporting views to Excel, and that should handle categorized views properly. There are surely other options available by now too (though I'm not familiar with them).
I have an excel file with information on my company's customers including addresses and latitude and longitude. I need to generate printed street maps showing a reasonable level of detail with pins showing the customers and bubbles displaying their info. Essentially I need to create something that looks like a Thomas Guide except with our customer info layered on to the street maps. I've been looking for DAYS and can't find any software to automate this process.
Currently I'm importing the data into Microsoft MapPoint, which does a fine job of generating the map with all necessary data. However MapPoint can only print what's currently displayed on the screen. So I'm stuck printing at a close zoom level, scrolling over, printing again, and continuing this process ad nauseum.
Is there maybe a way to automate this with VBA in MapPoint? I can find almost no info online about VBA for MapPoint.
Or maybe there's a piece of software out there that can do this at the push of a button. Printing a multi-page map of an area doesn't seem like that crazy of a demand.
Any help would be appreciated.
MapPoint's API is actually pretty well documented in the MapPoint help file, and most of the examples use VB6, which should be adaptable for VBA - you will need to add a reference to MapPoint's object model.
Yes you can automate the printing. Other approaches include copying to the clipboard; save to web page (and extract the Map's GIF image); or to use the GetPictureFromObject(). I recently wrote an article about using the latter from C# (it would be simpler from VB6 or VBA)
You could also print to a very large PDF, see the tips from this newsletter --
http://www.mp2kmag.com/update/mappoint.newsletter/2013-02-18/
Here's a direct link to the article --
http://www.mapforums.com/print-large-multiple-sheet-maps-any-printer-27603.html
Eric
I noticed that sitecore has the option of exporting users in an Excel format.
I need to have similar functionality for exporting 'participations', (a users can enlist to take part in an 'event', and if their entry is approved via a sitecore workflow, a 'participation' item is created in the content tree)
Since mostly everything in Sitecore is in essence based on items, and I want to export items to Excel, my question is - what are some of the best ways of doing this?
Questions:
Is there a way to re-use this functionality for regular items?
Would it be a good idea to create a custom admin page (any tips on doing this?) which has some custom code that reads the items from the database using the API?
are there sitecore plugins/shared source projects that can help me achieve this?
Or does anyone have a better idea? - would it be better to just store the participations in SQL? I'm mostly doing it this way because I want to make use of the 'free' functionality offers, for example workflow, but if that leads to me using anti-patterns please shoot me ;)
Link is different now: https://marketplace.sitecore.net/en/Modules/Advanced_System_Reporter.aspx
P.S. Couldn't leave a comment to original answer as I don't have enough reputation. Oh well :)
Found a most excellent shared source module which does exactly this (and much more)!
Basically it allows you to configure (and easily extend, if you need to) any kind of table based report on 'items'.
The report module shows up as an application in the sitecore menu (like the user manager tool) and comes with features such as xml,csv, xls export. It's also really easy to set up, once you get the hang of it.
http://trac.sitecore.net/AdvancedSystemReporter
I have a link in one column and, based on it, I want
Number of Google searches in column 2
Page rank of first result in column 3
I know this can be done, as I saw a friend pulling google search result right in Excel. If anyone knows, please share how I could do that.
If I correctly interpret your question, one of the tasks you had to do is
How do I get programmatically the Google page rank for a list of URLs?
You can find the code to do this in this CodeProject article:
Request Google´s Pagerank programmatically
Regarding the Excel part: it depends which programming framework or platforms you could use. You could use to create a .NET extension for Excel using the Microsoft Visual Studio Tools for Office.
From Excel there is Data->Get External Data->New Web Query. Is this what you want?
You have two options, both of which are unfortunately poorly documented.
If you are comfortable in C/C++, you can write a special DLL called an "XLL" that you can call during Excel runtime. There is some sparse documentation available. Note that this stuff isn't very fun to use.
If you prefer .NET, there is a binding for the entire Office suite outlined here that allows you to write COM-based methods that you can call from Office. It is intended for automation, but you can write any managed code you want and have Excel call into it.
There is also what Remou just suggested; I don't actually own a copy of Excel to test that out, but it may be the easiest option.
By link i meant keywords and not URL. I want to put a keyword in one cell and pull number of searches and page rank in adjacent cells.
I tried doing the same with web query in excel but i can only reach till the number of searches. that too not in the proper cell (trying to figure out). But i have no clue about how to get the pageranks.
I am not that tech savvy to code a binder or plugin for myself. Although i am checking the link by splattne. Please focus more light on it. Is it gonna be time consuming if i try to make this one..?
Regards
Thinkjayant
There are some nice plugins for this (in various languages) on GitHub:
http://github.com/search?langOverride=&language=&q=pagerank&repo=&start_value=1&type=Repositories&x=0&y=0
I have a PR checker functions in my Excel plugin "SeoTools".
http://nielsbosma.se/projects/seotools/