Home > e-infrastructure, office-software, service-is-programming > How to get dkRandomdata to run on 64-bit Excel

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 
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: