How to create MS Word document automatically by inserting text file content to the word document

There are many situations you may want to automate the MS Word document creation. In my previous posts, I have explained how to automate document generation using VBA. It was to create a new document. Every time you run the VBA code, it will create a new MS Word file.

How to create a template in MS Word

Now, I will explain how to insert a text file into the document as is at a specified location into an existing document. This is very useful if you are modifying an existing document. The main feature of this VBA is, it can insert new content at a specific location. That means you can insert new content into any part of the existing document, not just append the new content at the end of the file. The first step is to create a bookmark in the word document where the text file content will be pasted. Then, open the text file using VBA code and paste the content at the bookmark. Save the file with a different name. Before saving optionally you can remove the bookmark.

Below video shows details steps to insert a text file into MS word document


How to make a copy of current document MS Word automation with dynamic fields

How to make a copy of the current document using VBA in MS Word

It makes use of the dynamic fields to create a new document with different values. The MS word document can be used as a template file. Using this template you can create a new document without much effort. Click on the button and fill the necessary information. And the document will be created at the specified location. Edit the macro and modify the hardcoded values as per your needs. Change the location of the target file. The new file will be created and stored at this location 

This video explains the detailed steps to create and use this template.




Part 1:  how to use dynamic fields in ms word
https://www.youtube.com/watch?v=MlzyKniRckQ





you can download the ms word file here

https://drive.google.com/open?id=0B4UB3eOhhY26ZWhySlpROWlidEU

How to create a template in MS Word



This video shows how to create a template in MS Word. Templates are useful for automating word documents. When you have to create multiple documents with the same content but with a few new items, this template will come handy. For example, if you want to create sub-contract documents, with different clients, only the client-specific detail will change and the document format will remain the same. In this, you have to change only the client information, other things like contract rules will remain the same. In the template fill the client-specific information the generate the new document for the new client by just pressing a button. You can store repetitive values somewhere in the bookmark and place them wherever needed. The macro or the VBA code is very simple and it can be extended to add other functionalities.

There are 3 steps to create MS word templates.
Step 1
Create a section of bookmarks, which hold the value you enter. These are hidden.

Step 2
Create a field code to populate the values. Use ASK filed to get the values from user and store them in the bookmarks created earlier.

Step 3
Create fields where you want to place the values stored in bookmarks. use the FORMULA field to get the value from bookmark and place them wherever you want
code REF Bookmark name
Finally, you can create a macro to update all the values. For this, you can create a button and assign the code to it.

VBA code
-------------------------------------
Private Sub Update_Click()
Fields.Update
End Sub
-------------------------------------

KPSC KAS 2014 official key answers announced

KPSC KAS 2014 official key answers announced


If you are not able to access KPSC site, here is the pdf link

https://docs.google.com/document/d/1zYoZDndxOI5q8qJK8nmkzOtGI3hH0NQ9fNCbl7H73QY/edit?usp=sharing


How to save internet data when you have limited volume

If you have a limited volume of internet data, you should be thinking of restricting data usage by your browser and other PC utilities. There are 3 top things you can do to significantly save your internet data.

1. Disable Windows automatic updates

2. Disable images on browsers

3. Use the mobile version of websites instead of the desktop version


Disable Windows automatic updates

Windows will search and download updates whenever there is an internet connection if the Automatic Windows update is turned on. This may consume unnecessary data when you have limited volume. You can do this manually when you have unlimited data, for example when you are in the office or when are connected to unlimited broadband internet.
You can disable automatic updates in the control panel. In Windows 7, you can use a search to go to Windows update settings. Press the Windows button and type “update” and select “Windows update”. Then select change settings, in the first drop-down select “Never check for updates (not recommended)”.


Disable images on browsers

When you are just looking for text information like news, scores, etc., you can disable the loading of images that are not necessary. To disable image loading, follow the steps below on Google Chrome.

                Go to settings by selecting the wrench button at the top right corner of                         Chrome
                Search for “image”
                Then select “content settings”
                Under images select “Do not show Images”


Use the mobile version of websites instead of the desktop version

Many popular websites have their mobile versions, which consume significantly less data when compared to desktop versions. The Mobile version does not load any rich content like high-resolution images, animations, flash content, videos, etc., thus avoiding a lot of data transfer. If you remember the website names, then just add “m.” at the beginning of the URL to get the mobile version of the website.
www.indiatimes.com has mobile version m.indiatimes.com

How to check your YouTube channel statistics and compare with other channels

If you want to know your YouTube channel statistics you can do that by means of youtube.com/analytics. But if you want to see YouTube channel statistics other than yours, you can do that using a website socialblade.com. It gives you the details of a channel that includes, Total Grade, subscriber rank, video view rank, and progress graph on different metrics, etc. It also gives you the details of monthly and yearly estimated AdSense earnings if your channel is enabled with Google AdSense.

Another feature of this site is, you can compare your channel with other channels. There is an option to see YouTube channels which are similar to my channel. This will help in improving your channel viewership by learning what others doing.


It also offers YouTube top charts on different metrics. Top 100 YouTube networks, top 10 YouTubers, top channels by counties, by categories like education, comedy, technology, film gaming, entertainment, etc. 

Comment below for any queries.


How to implement Linux tail command in Perl

I have tried writing a Perl script to simulate Linux tail command - print last n lines from a file. This is one of the common interview questions in Perl. This can be extended to print selected lines of other Linux commands like head. It works perfectly fine.


print "\nImplements linux tail command in perl \n\n";

$file   =  $ARGV[0];
$n = $ARGV[1];
open(FILE, $file);
@arr = ;
close(FILE);
$length  = scalar(@arr);
$n = $length  - $n;

while($n<$length )
{
print $arr[$n];
$n =$n + 1;
}

Comment  below if you have a better option