Archive

Posts Tagged ‘VBA’

How to get dkRandomdata to run on 64-bit Excel

  1. Dick Kusleika made this very useful random data generator for Excel (more random data sources I plan to list here).
  2. To get this to run on 64-bit Excel 2013, I need to make a few quick changes in the source (which will break on 32-bit Excel):
    1. First, the usual “must be updated for use on 64-bit systems”: , fixed by this (but note the 1st line):
      Private mlParentPtr As LongPtr 'trp:Long 

       

      #If VBA7 Then 

       

      Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ 
      	(dest As Any, Source As Any, ByVal bytes As Long) 

       

      #Else 

       

      Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
      (dest As Any, Source As Any, ByVal bytes As Long) 

       

      #End If 
    2. Then, to fix the various “Type mismatch” errors , e.g. at , change Lomg into PtrLong: in these locations:
      1. above: Private mlParentPtr As LongPtr 'trp:Long 
      2. Private Function ObjFromPtr(ByVal pObj As LongPtr) As Object 
        'trp Private Function ObjFromPtr(ByVal pObj As Long) As Object 
  3. Then I am finally getting to the xmlDoc As MSXML2.DOMDocument error on Windows 8.1, but that has been solved in the comments here earlier this year (also for Windows 8.1, but apparently with Excel 32-bit): I changed MSXML2.DOMDocument to MSXML2.DOMDocument60 where I could:
    1. Dim xmlDoc As MSXML2.DOMDocument60 'trp: Dim xmlDoc As MSXML2.DOMDocument 
    2. WriteToFile: 
      
      
      
      1. Dim xmlDoc As MSXML2.DOMDocument60 
        'here it is already fixed? Dim xmlDoc As MSXML2.DOMDocument6 
      2. Dim xmlStyle As MSXML2.DOMDocument60 
      3. Dim xmlOutput As MSXML2.DOMDocument60 

    3. LoadFromFile(): Dim xmlDoc As MSXML2.DOMDocument60 
      'trp: Dim xmlDoc As MSXML2.DOMDocument 
    4. testxml() (looks like the XML issue has been worked on since the comments): 
      
      
      
      1. Dim xmlDoc As MSXML2.DOMDocument60 
        	'trp: Dim xmlDoc As MSXML2.DOMDocument 
      2. Set xmlDoc = New MSXML2.DOMDocument60 
        	'trp: New MSXML2.DOMDocument 

    5. test_writetofile(): 
      
      
      
      1. Set xmlDoc = New MSXML2.DOMDocument60 
        'here it is already fixed, and here 
      2. Set xmlStyle = New MSXML2.DOMDocument60 
      3. Set xmlOutput = New MSXML2.DOMDocument60 

  4. Finally, if you have trouble getting the add-in buttons to show in Excel 2013 ribbon, close all workbooks, and you may (but I did not) have to restart Excel (KB2761240):
    1. image
    2. Viola. And I sure like me some Seinfeld references in my sample data…. Smiley 

Bugs in MS-Calendaranalytics?

  1. Is there an Off-by-1 bug in MS-Calendaranalytics pivot chart?
    1. I am hovering (as an example) over the first name in the upper list which displays the right name as tooltip, the first name in the second listimage
    2. I guess I could learn DAX to fix this one myself, but what I have found myself doing is copy/paste the legend control from underneath, which does not exhibit this apparent bug, as a screenshot over the wrong legend (Seems strangely inadequate!).
  2. Cannot run visual basic macro because of a syntax errorimageVersion 1 on Excel 2010 (64-bit) on Windows 7 (64-bit). Restarting (Excel/Windows) made this go away.
  3. This stopped working on load from one day to the next, without the file getting saved and updated in between: System.Runtime.InteropServices.COMException (0x80070490): Element not found. (Exception from HRESULT: 0x80070490)
    at Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IHostItemProvider.GetHostExtender(String extenderType, String extenderCookie, IntPtr& extenderObject)
    at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.Office.Tools.IHostItemProvider.GetHostExtender(Type primaryType, String primaryCookie)
    at Microsoft.Office.Tools.Excel.ControlSiteImpl..ctor(IServiceProvider serviceProvider, IHostItemProvider hostItemProvider, String primaryCookie, String identifier, Object containerComponent, UInt32 officeVersion, Control control, _OLEObject extenderControl, Boolean isDynamic)
    at Microsoft.Office.Tools.Excel.FactoryImpl.Microsoft.Office.Tools.Excel.Factory.CreateControlSite(IServiceProvider serviceProvider, IHostItemProvider hostItemProvider, String primaryCookie, String identifier, Object containerComponent, Control control)
    at Microsoft.Office.Tools.Excel.Controls.Button..ctor(Factory factory, IHostItemProvider hostItemProvider, IServiceProvider serviceProvider, String cookie, String extenderCookie, Object container, String identifier)
    at ExchangeAnalytics.Sheet4.InitializeControls() in C:\tfs\Exchange Analytics\ExchangeAnalytics\ExchangeAnalytics\What.Designer.cs:line 169
    at ExchangeAnalytics.Sheet4.Initialize() in C:\tfs\Exchange Analytics\ExchangeAnalytics\ExchangeAnalytics\What.Designer.cs:line 55
    at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.ExecutePhase(ExecutionPhases executionPhases)
    at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)

Code documentation for a quiz template based on MS-Word

  1. trpQuizGenerator allows for using simple markup (view training here) to produce cloze quizzes in large fonts, for easy screen sharing through the face-to-face classroom management system (see samples of quizzes based on this template here.)
  2. Click the table of contents below to browse the VBA documentation built with Aivosto.
  3. image

Paper @ IALLT 2013: Driving Tutorial Call Into The Face-To-Face Classroom, and What It Took…

…has been accepted for inclusion in the program for IALLT 2013, June 11-15 at the Pinecrest School (Fort Lauderdale, FL)/Florida International University (Boca Raton, FL) and was presented on June 14: Here are abstract and slide deck:

[office src=”https://onedrive.live.com/embed?cid=4FA3329905D7E1CE&resid=4fa3329905d7e1ce%2185931&authkey=AFswJ0h4LVABrYc&em=2″ width=”650″ height=”528″ frameborder=”0″ scrolling=”no”]

Code documentation for a job ticket assignment and reporting application

  1. JobAssignments allows for managing job tickets with easy tagging and filtering of task assignments, and for aggregate analysis and reporting. 
  2. Originally developed only for simple tag aggregation reports (watch a demo), JobAssignments  can now also analyze the tag graph: jobassignments_tags_keyneighbours
  3. Click the table of contents on the right to browse the VBA documentation built with Aivosto.
  4. imageimage

Source code samples

Spanish movie subtitles exercise project

  1. objective:
    1. To facilitate lesson delivery and student interaction in our Language Resource Center I have programmed a VBA- and MS-Word- based cloze quiz template with batch creation based on a simple markup language and rich autocorrecting functions that use string metric algorithms (Damerau-Levenshtein). image001The template supports typical activities in the digital language lab: digital audio- and video-based  listening comprehensions, e.g. Quiz Template with Chanson Lyrics, image003 and speaking and dialoguing activities for language learning or other examples):
    2. Teachers can use them as exercise-generating engines: the templates allow copy/paste of their own exercises into this template. To also automatically create language teaching materials with the required markup in French, German, Italian and Spanish (mostly based on movie subtitles) for this template, I wrote a C#-program that applies an expanding library of regular expressions which can match typical language learner tasks:
      1. function words, image002e.g for Spanish Movie Subtitling Exercise Creation, image005
      2. affixes/infixes
        1. and lexical subsets taken from corpus linguistic research on word-frequency (SUBTLEX, Opensubtitles)).
    3. This template support the learner by strengthening learner autonomy and providing immediate corrective feedback and – in conjunction with the grouping facilities of the Center’s classroom management system infrastructure – allow for custom-tailored instruction based on the immediately available outcome of formative assessments, and also automated summative feedback: image004
    4. A Spanish TA can provide meaningful vocabulary and grammar questions as input for cloze listening comprehension exercises that  I will create on the basis of subtitles  I have for Spanish movies being used in (= put on reserve for viewing in the LRC by) the Spanish program  consistent exercises that students can take while watching the movie in class adapted meaningfully to technical possibilities of template
    5. Screencasts Demos:
      1. making of template exercises
        1. manually marked up: Part II to minute 4, Part III
        2. alternatively, markup can be generated by regular expressions which we will try to develop:
      2. use of template exercises : Part II, from minute 4
        1. overview of sample exercises (German)
        2. sample application (exam setting)
      3. materials
        1. source texts:subtitle files for proof reading
            1. Amores Perros
            2. Pedro Almodovar – Mujeres al borde de un ataque de nervios
            3. Pedro Almodovar – Hable Con Ella
        2. ideas for exercise needs that fit into this cloze format
          1. grammar
            1. function words
            2. affixes
          2. vocabulary
            1. frequency-based wordlists from corpus linguistics
            2. word lists from current textbook
      4. Deliverables: combos of
        1. materials
        2. exercise ideas

Examples of Quizzes based on MS-Word template

2011/03/02 2 comments

You can view a series of examples for formative assessments, used during face-to-face teaching (German) settings,  in this screencast:.