Excel VBA: submit an AI video job and poll it with Application.OnTime
An Excel macro posts a Wan 3.0 job to Sume with ServerXMLHTTP, saves the job id in a cell and re-checks status with Application.OnTime without blocking Excel.

In Excel, do not loop with Sleep while a video renders; that freezes the workbook. Use Application.OnTime to call a macro again in 15 seconds, so each call reads the status once and returns. The macro posts to https://api.sume.com/v1/videos with MSXML2.ServerXMLHTTP.6.0, writes the returned job id to a cell, and keeps rescheduling until the status response says terminal (Sume jobs guide, read 2026-10-06).
A planning sheet is a good fit: one row per shot, a model and duration column, and a macro that submits each row. Each Wan 3.0 720p second is $0.125 on Sume, so a row of 5 seconds is $0.625.
What is the macro?
VBA has no built-in JSON parser, so the code finds the two fields it needs with InStr. Keep SUME_API_KEY in a Windows environment variable rather than in a cell.
Function Call_(verb$, url$, Optional body$ = "") As String
Dim h As Object: Set h = CreateObject("MSXML2.ServerXMLHTTP.6.0")
h.Open verb, url, False
h.setRequestHeader "Authorization", "Bearer " & Environ("SUME_API_KEY")
If body <> "" Then h.setRequestHeader "Content-Type", "application/json"
h.setRequestHeader "Idempotency-Key", "xl-" & Sheet1.Range("A1").Value
h.send body
Call_ = Replace(h.responseText, " ", "")
End Function
Sub Submit()
Dim r$, p&
r = Call_("POST", "https://api.sume.com/v1/videos", _
"{""model"":""wan-3.0"",""prompt"":""Steam over a coffee cup"",""duration"":5,""resolution"":""720p""}")
p = InStr(r, """id"":""") + 6
Sheet1.Range("B1").Value = Mid(r, p, InStr(p, r, """") - p)
Application.OnTime Now + TimeSerial(0, 0, 15), "Poll"
End Sub
Sub Poll()
Dim r$
r = Call_("GET", "https://api.sume.com/v1/jobs/" & Sheet1.Range("B1").Value & "/status")
If InStr(r, """terminal"":true") > 0 Then
Sheet1.Range("C1").Value = IIf(InStr(r, """sume_status"":""completed""") > 0, "completed", "not completed")
Else
Application.OnTime Now + TimeSerial(0, 0, 15), "Poll"
End If
End SubWhat are the limits of this approach?
OnTimeonly fires while the workbook is open and Excel is idle; close it and the poll stops, but the render continues at Sume, so reopen and runPollagain with the saved id in B1.- The macro uses a fixed 15 second delay for brevity. Read
next_poll_after_secondsfrom the response if you submit many rows at once. ServerXMLHTTPis a Windows component; Excel for Mac needs a different HTTP route.
Does re-running the script bill a second clip?
It can if you re-run the submit step. Send a stable Idempotency-Key on POST /v1/videos (here a fixed string; in practice a row id) so a repeat returns the original job. A give-up on the client never cancels the render, so keep the job id and read it again (Sume jobs guide, read 2026-10-06).
Sources
Related posts
More in Developers
- Express receiver for Sume TTS job webhooks: raw body and HMAC
A Node Express route that verifies Sume job webhooks over the raw body, accepts rotated secrets, rejects an empty secret and answers 204 before any work.
- Fall back to a second image model after three 502s: a Python breaker
Sume returns 502 when an image job fails inside the wait budget. Count them, switch to a second model id after three, and use a new idempotency key per model.
- Gemini CLI and the hosted Sume server: do not rely on env in headers
Add the hosted Sume server to Gemini CLI with httpUrl and a bearer header. Gemini expands env vars only in the env block; set a timeout above jobs_wait.
- Get the video URL from a Sume webhook: pick the artifact by type
A Sume job.completed payload lists artifacts with id, url, type and content_type. Select the video by content_type, not array index. TypeScript for Node.
Written by Sume