IIRC that's a pretty generic automation error code. One thing I recall from 
when I was doing more COM stuff was that VFP could lose track of object 
references particularly inside loops. Your code doesn't seem to be doing that 
sort of thing but that's my first thought.

Have you tried trying to do this interactively from the VFP command window? 
Generally speaking I would prototype COM stuff in the command window until I 
got things almost exactly perfect. 😊 

--

rk

-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Alan Bourke
Sent: Friday, June 13, 2025 6:47 AM
To: [email protected]
Subject: Automatic Excel Power Query CSV Import

Any Excel automation mavens in the audience? I'm trying to automate what Excel 
does when you do 'Get Data' from Text\CSV via PowerShell. I've recorded that 
process as a macro and the code in the linked Gist is attempting to replicate 
the macro VBA.

However no matter what I do it throws a 1426 COM error '800a03ec: Unknown COM 
status code' when attempting to add to the Workbook ListObjects collection.

https://learn.microsoft.com/en-us/office/vba/api/excel.listobjects.add

Probably something stupid - can anyone see any issue with the code ?

https://gist.github.com/AlanPBourke/091e4aa607239fa69d5f544e31bc958b

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/mw4pr10mb65840d306d57b093ce8c0246d2...@mw4pr10mb6584.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to