inject static content word document while mail merge is running? - vba

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.

Related

Trying to change the subject line in a MailToRecipient Word file, based on a Building Block

I have a word document with a building block dropdrown to choose from several templates. I have the Word document set with a tool bar with the Send To Recipient email option. I'm trying to figure a way to get the subject line to change depending on what building block is chosen, if it's even possible.
Currently, my office is using different word files for each subject line, and I'm trying to get all templates in one file to cut down on all the different files workers need to have open at once.
Is this possible?
I have limited vb experience, but I have tried searching for macros and code that was similar to what I needed, and changing things to fit, but I'm at a loss. Anything I try outside of that just results in the subject like being static, remaining as the last edit.

Automating the process of creating doc word

I have a .doc template I use for building CVs for many friends.
I'm trying to automate this process using simple library/program, for exmaple, that can accept data like name, email, phone number, job title, and can create the .doc automatically.
What framework can be used for that to make it fastest i can?
Thanks,
Tal
Where exactly are keeping this template and are your friends plugging in the data or are you doing it all yourself?
No matter what, you're basically looking to do a data merge. An example of a data merge is a mail merge:
https://support.microsoft.com/en-us/help/294683/how-to-use-mail-merge-to-create-form-letters-in-word
The same thing really applies to what you're accomplishing to do.
You can take a template, specify the fields that require variable data (aka the different information that's changing), and then just use a spreadsheet to pull the data from and plug it in.
Now the question you'll probably be wondering next is how data merges use spreadsheets. The way data merges work is that each column you set with data in it, that should correspond to the changing lines in your template. I strongly recommend you read up on this further - it's not that difficult to do once you get the hang of it.
The last question is probably how you'll compile the data into this spreadsheet. Are your friends going to fill out an online form perhaps? If so, you'll need an online form of some sort perhaps, so you'll need to use some PHP, have a database to store the information from the form, and then just go to the table and export the information as a .csv file after you see you have enough data populated in your database table to do a data merge.
If you don't have access to MS Office, I'm sure you can accomplish this in OpenOffice.org instead (which is free/open-source).
Hope this helps.
At my job we do data merges all the time - for mail merges, for letters that need to be personally address to individual recipients, and we do this for people who need to print dozens of different business cards for different employees. We take their business card template and just do a data merge from a spreadsheet to save time on needing to set up individual files. P.S. you can also use Adobe inDesign for this, if you know how to use it.

Use VBA to pull store locations

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.

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.

Creating variables/automation in Microsoft Word

I write a lot of proposals in MS Word and we use a template that we go in and change out specific values, i.e. Client Name (used multiple times throughout document), URL, Price, Page count, etc... Sometimes these variables get overlooked or missed. I wanted to know is there a way to just type the Client name once and have it update throughout the page. Also is it possible to edit these values in a separate document and link the proposal template to generate a modified proposal each time?
I'd like to know if all this is possible within just Word and not using VB scripts or anything like that.
Mail merge?
Or maybe a template/form would be better for you.