Use VBA to pull store locations - vba

I am trying to pull all the store locations from several different websites, for example Sephora http://www.sephora.com/store-locations-events and Freshpet http://freshpet.com/storelocator/.
Every site constrains the radius for the search, so to find all locations, the only thing I have come up with is cycling through every zip code and then filtering out duplicates. Is there a way to use VBA to manipulate the search radius using VBA to just search the entire United States, instead of only up to 100 miles? That way, I could just do one search for each of these sites.
Thanks!

I don't think you can do it on those javascript sites. VBA works great with HTML, but not so great with javascript and flash. Also, the code isn't even exposed, so the search results must be generated dynamically from the server. I just did a search on that freshpet site and got the results then did a right-click and viewed the source code and nothing that I searched for was in the code.

Related

How to compare content between two web pages in different environments?

We are in the process of building a website from scratch from an existing website. The web page is an identical copy, and as the web page contains many pages we need a way to compare content between the sites. It is of course possible to do manually, but it takes both a lot of time and entails a risk of human errors.
I have seen that there are services that offer this by inputting two URLs which are then analyzed and where discrepancies are presented. However, these cannot be used as our test environment is local (built in Sitecore).
Is there a way to solve this without making our test environment available online (which is not possible)? For example, does software exist for this, or alternatively some service where you can compare a web page that is online with one that is local?
Note that we're only looking for content comparison (not visual).
(Un)fortunately there's many ways to do this, but fortunately there are some simple ones.
What I would do is:
Get a list of URLs for each site. If the Sitemap is exhaustive, then you could use that, if it's not you might want to run some Sitecore Powershell to get the lists.
Given the lists (from files, or Sitecore API or something), write a program to visit each URL, get the text of the page after it's done rendering, and save it to disk (something like Selenium is good for this and you can use any language). You'll want some folder structure like host/urlpart/urlpart/pagename.txt, basically the same as your content tree.
Use some filesystem diff program like WinMerge to compare the two folders
This is quick and dirty, but a good place to start.

Visio Hyperlinks query

The users have documents in Sharepoint document library. I need to be able to get the urls of these documents easy within Visio. Would I need to write something in VBA which gets the urls of these documents from Sharepoint, or is there an easier option ?
I have looked at the net use command so they can map a drive but that does not give the url.
anyone done anything like this before ?
SharePoint exposes XML interfaces that you can use to determine elements in a table or items in a library (which is a known and static location in SharePoint).
What you can use and how you access it will depend on your version of SharePoint and how it is configured on your network. However, there are plenty of examples on the internet that you can search in your favourite search engine (Alta Vista anyone?) which will get you started with some code. I expect you will have some specific questions once you start coding.
It has been a while since I did this.

inject static content word document while mail merge is running?

The rules available for mail merge in ms word 2007 appear to be limiting. I have created a mail merge to fetch about 10000 rows of data from excel and merge this data into word document by using a mail merge. This works as expected I have even used some conditional statements to display default text when a field is empty. However, I have been asked to insert a static page every 50th page which would include messaging not provided in excel file. When this static text appears on page 50, then 100, then 150 etc it would be static text and no other fields from merge would appear on page. In other words these fields would be replaced by static text. Is there an easy way to do this? I was thinking I could code something in vba and create a new page on the fly when a certain page number is reach ex. 50
Thoughts are much appreciated.
There is a lot of code on the Internet. Start with MSDN. If you google for "VBA MailMerge" you will also come across a number of links to threads in StackOverflow dealing with calling MailMerge from Excel. I suggest you focus on a method in which you imagine that you would like to work and research the code that might do the job. You will then arrive quickly at a stage where you actually might need the kind of help that is being offered here to abundantly.

VBA Word: How to separate content from formatting information?

I am trying to write a VBA-macro that converts a given MS word document into a sequential list of the document objects contained in that document (e.g., Paragraph, Table, etc.). For each of those objects I want to extract the text contained and its explicit formatting information to save it in a DB.
Would have any pointers for me how to get started? Are there any elegant solutions to this document parsing task?
Without knowing your full requirements this is just some suggestions.
You may be able to do what you want, but it will be a mammoth task to pull apart word documents and be able to stich them back together. If you di dwant to go with this approach, the best might be to pull out paragraphs, images etc and save these sections as individual documents in your database. They can then be put back together using
For i = 1 To ActiveDocument.Paragraphs.Count
MsgBox ActiveDocument.Paragraphs.Item(i)
Next i
ActiveDocument.Content.InsertAfter AnotherDocument
This is incredibly basic and will be a LOT of work to get working correctly.
I wonder would turning the documents into html be better (done simply by saving as HTML) and then you can use open source libraries to allow users to edit parts of the document. Eg add the jeditable plugin for jquery and almost any paragraph in your html word document becomes editable. A simple backend php script to save the changes and you have something that works. You can then also note what has changed for translation purposes.
They docs can be saved back as word docs or pdfs before being sent to the customer
Just an idea.

Interactive editable spreadsheet in Google Docs

I have created a spreadsheet in google docs. The spreadsheet takes some input, calculates some results, and displays the results numerically but also as a graph.
I would like to publish this spreadsheet, so that anyone can input and get the results and the graphs. I tried the Publish to the Web option (from File Menu), but the spreadsheet becomes static (no calculations possible on new values)
I tried the Share option. However when choose anyone can view the spreadsheet is not interactive. When i choose the anyone can edit option the file is usable, but my concern is that if I publish this on the internet and 2 users want to calculate simultaneously based on different values it will mix things up.
Is there anyway to accomplish what I require without setting up a website or programming in Javascript? I do not need to protect any of the calculation routines, I only require that the spreadsheet starts everytime with the default settings, the edits are not saved and the spreadsheet is interactive.
Seems like you may want to publish your Google Sheet as a template. Doing so will let strangers "deploy" a copy of your spreadsheet, for their own use (and without conflicting with other web users).
Google Docs template gallery
Instructions for submitting a template
Caveat: Until Google adds support for publishing "new" Google Sheets as templates, you'll likely want to submit a spreadsheet in the "old" format.
I might suggest using Protected Ranges.
https://drive.googleblog.com/2012/08/lock-down-cells-with-protected-ranges.html
Basically locked cells and you should be the only one able to manipulate the locked cells to you can freely set the page to be editable.
You can also specify the Range of cells that you wish to use when embedding. (See the publish options).
These two methods should help you with your project.