Skip to content

Instantly share code, notes, and snippets.

Option Explicit
'References:
'http://stackoverflow.com/questions/19071173/ms-word-macro-how-to-adapt-so-it-get-data-from-my-excel-file
'http://www.mrexcel.com/forum/excel-questions/32187-convert-variant-array-string-array.html
Dim TargetList() As String
Public Sub GetWordsFromExcelAndHighlight()
Dim lngIndex As Long
@mvark
mvark / PSDownloadFiles
Last active August 29, 2015 13:57
PowerShell script to download a list of files that have a predictable number pattern
# PowerShell script to download a list of files that have a predictable number pattern
for ($i=1; $i -le 10; $i++)
{
$startTime = (Get-Date)
# Download files that have the naming format File1.txt, File2.txt etc..
(new-object System.Net.WebClient).DownloadFile("http://example/file$i.txt","C:\temp\file$i.txt")
$endTime = (Get-Date)
# Echo Time taken
"Time taken to download file$i : $(($endTime-$startTime).totalseconds) seconds"
}
javascript:(function()%7Bdocument.getElementById(%22txtInput%22).value%3Ddocument.getElementById(%22txtCaptcha%22).value%7D)()
@mvark
mvark / StoreMinMaxTempIntoAzureTable.ps1
Created May 14, 2014 13:56
This PowerShell script to save min, max temperature fetched from Yahoo Weather API using YQL & store it in Windows Azure Table
Add-Type -Path "C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.1\ref\Microsoft.WindowsAzure.Storage.dll"
$refs = @("C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Services.Client.dll")
$code = @"
using System;
using System.Data.Services.Common;
[DataServiceEntity]
javascript:(function() {
a = document.getElementsByTagName('a');
for (i = 0; i < a.length; i++) {
a[i].href = 'http://www.google.com/gwt/x?noimg=1&btnGo=Go&source=wax&ie=UTF-8&oe=UTF-8&u=' + encodeURIComponent(a[i].href);
a[i].style.backgroundColor = '#f0f0f0';
$.getJSON("https://spreadsheets.google.com/feeds/list/insert-spreadsheet-key/od6/public/values?alt=json", function(data) {
for (var i = 0; i < data.feed.entry.length; i++){
//first row "bookname" & "price" columns
$('#results').append(data.feed.entry[i].gsx$bookname.$t + " Price: " + data.feed.entry[i].gsx$price.$t + "<br/>");
}
});
<!DOCTYPE html>
<html>
<head>
<title>My Books</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script>
//Telling Angular to use our module with ng-app
//Second parameter of module is a blank array
var myApp = angular.module("myApp", []);
@mvark
mvark / AphoneticWords.html
Created December 31, 2014 08:01
Track & learn about Aphonetic Words. Demo - http://mvark.blogspot.in/p/aphonetic-words.html?m=1
<!DOCTYPE html>
<html>
<head>
<title>Aphonetic Words</title>
</head>
<body>
<style>
body { margin: 2px; font-size: 40px; }
.cell { margin: 5px; }
audio { width:45px; height:25px;}
@mvark
mvark / WeatherTrackerGenericHandler.cs
Last active August 29, 2015 14:12
Generic Handler (.ASHX) which draws info from Yahoo Weather API & stores in Windows Azure Table. More info - http://mvark.blogspot.in/2014/01/how-to-make-automated-call-to-web-page.html
/*
This Generic Handler (.ASHX) code sample shows how to draw info from Yahoo Weather API & store it in Windows Azure Table.
The code can be configured to be triggered by an automated call to the Generic Handler (.ASHX) through Windows Azure Scheduler
*/
<%@ WebHandler Language="C#" Class="temp" %>
using System;
using System.Web;
@mvark
mvark / DownloadAsWordWithFooter.vb
Created January 8, 2015 10:23
Add a header or footer to a dynamically generated Word document using HTML & CSS (observe line#s 32-37, 49, 73-76) - http://mvark.blogspot.in/2007/02/how-to-add-header-or-footer-to.html
<%@ Page Language="VB" %>
<script runat="server">
Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'build the content for the dynamic Word document
'in HTML alongwith some Office specific style properties.
Dim strBody As New System.Text.StringBuilder("")
strBody.Append("<html " & _