Skip to content

Instantly share code, notes, and snippets.

View brucemcpherson's full-sized avatar

bruce mcpherson brucemcpherson

View GitHub Profile
Option Explicit
' the new google sheets are bit different than the old.
' these are the new versions.
' note that you can also use dbAbstraction for updating, querying and reading sheets.
' however this is a port of the old to the new sheets layout
' public new sheets need to be published, private not.
' v1.0
' note that things have changed between google sheets old and new - public sheets must be published, private sheets need oauth2
' import google workbooks
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 15/10/2013 10:52:06 : from manifest:5055578 gist https://gist.github.com/brucemcpherson/6937529/raw/usefulEncrypt.vba
Option Explicit
' this stuff needs the capicom library and will only work for 32bit excel
' v1.5
' for 64 bit - no encryption is being done yet
'
Public Function encryptMessage(ByVal TobeEncrypted As String, ByVal salt As String) As String
' adapted from http://msdn.microsoft.com/en-us/library/windows/desktop/aa382018(v=vs.85).aspx
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 8/9/2014 3:09:54 PM : from manifest:5055578 gist https://gist.github.com/brucemcpherson/6937450/raw/cOauth2.cls
Option Explicit
'" based on Kyle Beachill Oauth2
'" for credits and details see
'" http://ramblings.mcpher.com/Home/excelquirks/guests/oauth2
' for details on this implementation see http://ramblings.mcpher.com/Home/excelquirks/googleoauth2
' v1.5
Private pPackage As cJobject
Private pCb As cBrowser
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 15/10/2013 10:52:07 : from manifest:5055578 gist https://gist.github.com/brucemcpherson/6937174/raw/oauthExamples.vba
Option Explicit
' oauth examples
' v1.1
' convienience function for auth..
Public Function getGoogled(scope As String, _
Optional replacementpackage As cJobject = Nothing, _
Optional clientID As String = vbNullString, _
Optional clientSecret As String = vbNullString, _
Optional complain As Boolean = True, _
@brucemcpherson
brucemcpherson / blisterCustoms.vba
Created September 30, 2013 13:01
VBA implementation of GAS blister functions
Option Explicit
' this accesses shared validation lists from Google Apps
' see http://ramblings.mcpher.com/Home/excelquirks/listsandvalidation for details
Public Function blisterData(ParamArray args() As Variant) As Variant
Dim givenArgs() As String, i As Long
' have to repeat this in each function to turn params into an array
' unless someone knows how to pass a paramarray to another function ?
For i = LBound(args) To UBound(args)
givenArgs = pushGivenArgs(givenArgs, args(i), i)
@brucemcpherson
brucemcpherson / pinyin.xml
Last active December 22, 2015 04:09
manifest for pinyin converter
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details"><manifest description="pinyin converter" contact="bruce@mcpher.com"><gists><item1 gistid="6415587" version="" filename="pinyin.vba" module="pinyinModule" type="module"/><item2 guid="{000204EF-0000-0000-C000-000000000046}" name="VBA" major="4" minor="0" description="Visual Basic For Applications" type="reference"/><item3 guid="{00020813-0000-0000-C000-000000000046}" name="Excel" major="1" minor="6" description="Microsoft Excel 12.0 Object Library" type="reference"/><item4 guid="{00020430-0000-0000-C000-000000000046}" name="stdole" major="2" minor="0" description="OLE Automation" type="reference"/><item5 guid="{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" name="Office" major="2" minor="4" description="Microsoft Office 12.0 Object Library" type="reference"/><item6 guid="{3F4DACA7-160D-11D2-A8E9-00104B365C9F}" name="VBScript_RegExp_55" major="5" minor="5" description="Microsoft VBScript Regular Expressions 5.
@brucemcpherson
brucemcpherson / pinyin.vba
Last active December 22, 2015 04:09
pinyin converter custom vba functions
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 02/09/2013 19:06:03 : from manifest:6415598 gist https://gist.github.com/brucemcpherson/6415587/raw/pinyin.vba
Option Explicit
Private Const NOTONE = 5
Private Const COLORTYPENONE = 0
Private Const COLORTYPEHTML = 1
' v1.0
'
' accents a pinyin string with optional html colorizing
' @param {string} inputString the string to be converted
' @param {number=} optColoringType - 0 = no coloring(default), 1 = return html with coloring options given
@brucemcpherson
brucemcpherson / cplace manifest
Last active August 5, 2017 17:47
cplace manifest
<?xml version="1.0"?>
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details">
<manifest description="cPlace example demo" contact="bruce@mcpher.com">
<gists>
<item1 gistid="6321540" version="" filename="testPlace.vba" module="testPlace" type="module"/>
<item2 gistid="6321540" version="" filename="cPlace.cls" module="cPlace" type="class"/>
<item3 guid="{000204EF-0000-0000-C000-000000000046}" name="VBA" major="4" minor="0" description="Visual Basic For Applications" type="reference"/>
<item4 guid="{00020813-0000-0000-C000-000000000046}" name="Excel" major="1" minor="6" description="Microsoft Excel 12.0 Object Library" type="reference"/>
<item5 guid="{00020430-0000-0000-C000-000000000046}" name="stdole" major="2" minor="0" description="OLE Automation" type="reference"/>
<item6 guid="{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" name="Office" major="2" minor="4" description="Microsoft Office 12.0 Object Library" type="refer
@brucemcpherson
brucemcpherson / cPlace.cls
Last active December 21, 2015 14:39
simple example for write up
Option Explicit
Private pPlace As String
Private pLat As Double
Private pLon As Double
Public Function init(sPlace As String, dLat As Double, dLon As Double) As cPlace
pPlace = sPlace
pLat = dLat
pLon = dLon
Set init = Me
End Function
@brucemcpherson
brucemcpherson / restlibraryexamples.vba
Last active December 16, 2015 10:19
rest library examples to test excel rest library - ramblings.mcpher.com
Option Explicit
'for more about this
' http://ramblings.mcpher.com/Home/excelquirks/classeslink/data-manipulation-classes
'to contact me
' http://groups.google.com/group/excel-ramblings
'reuse of code
' http://ramblings.mcpher.com/Home/excelquirks/codeuse
' google rules and api documentation