Based almost entirely on the work of cristianbuse's MemoryModule, this is merely a minimal example and substitute for CopyMemory in VBA without any other helper functions.
Kudos to Cristian for building the original solution.
let | |
//Computed Helmert transformed X coordinate. | |
//@param {number} X - Cartesian X coord in meters | |
//@param {number} Y - Cartesian Y coord in meters | |
//@param {number} Z - Cartesian Z coord in meters | |
//@param {number} DX - Cartesian X translation in meters | |
//@param {number} Y_Rot - Y rotation in seconds of arc | |
//@param {number} Z_Rot - Z rotation in seconds of arc | |
//@param {number} s - Scale in ppm | |
//@returns {number} Helmert transformed X coordinate |
Based almost entirely on the work of cristianbuse's MemoryModule, this is merely a minimal example and substitute for CopyMemory in VBA without any other helper functions.
Kudos to Cristian for building the original solution.
This gisst was made in response to a reddit thread here. OP Claims that ChatGPT is good at writing basic VBA code if you give it clear instructions.
Explaining code in such a way that it codes the correct thing is pretty awful though, slow and tedious... Let's try to do that for stdTimer.
The prompt I used was as follows:
I want to write a predeclared VBA class. Next I want to add public event
Tick
with no parameters. Next I need a remote workbook property with events and a callback object. I want aCreate
method which acts as a constructor, which creates and initialises an object via theprotInit
method. TheCreate
method should have paramsmilliseconds
and an optionalcallback
of typestdICallable
. In the initialisation method I need to set access to the VB object model to true, then create a new instance ofApplication
and wi
It is quite common at least in our business that when people are building spreadsheets they accidentally link data without properly acknowledging the linkage. This can cause error messages later on which can irritate users. The error messages you might recieve often contian the text:
Microsoft Excel cannot access the file 'https://.../myfile.xlsx'. There are several possible reasons:
or
Cannot download the information you requested
Now let's actually look at the code originally investigated in the author's original video ported to VBA
public sub run()
while true
Dim path as string
while (path = requestedUrls.poll()) != null
downloads.add(new DownloadState(path))
wend
if not me.connectionDisabled then
Dim iterator as ListIterator
'Example CSV: | |
' Column1,Column2,Result | |
' 1,2, | |
' 2,3, | |
' 3,5, | |
'Results in: | |
' Column1,Column2,Result | |
' 1,2,2 | |
' 2,3,6 | |
' 3,5,15 |
name: VBA-OfficeJS bridge test | |
description: A test to attempt to listen to VBA changes to the customXMLParts structure. | |
host: EXCEL | |
api_set: {} | |
script: | |
content: |+ | |
/* VBA USAGE EXAMPLE | |
'Example from VBA: | |
'Requires JsBridge from here: https://github.com/sancarn/VbaJsBridge | |
'ScriptLab test can be downloaded here: https://gist.github.com/sancarn/b974b650f4b451ff2de51861af1671b1 |
name: Blank snippet | |
description: Create a new snippet from a blank template. | |
host: EXCEL | |
api_set: {} | |
script: | |
content: | | |
type IXMLWatcherListener = (e: any) => void | |
class XMLWatcher { | |
private interval: number; | |
private listeners: IXMLWatcherListener[]; |
#If VBA7 Then | |
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr) | |
Private Declare PtrSafe Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As Any, ByVal Length As Long) | |
#Else | |
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) | |
Private Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As Any, ByVal Length As Long) | |
#End If | |
Public Sub test() | |
Debug.Print Deref(ObjPtr(Application)).Name |