This error is thrown for an invalid path.
Instead of SYS(5) + GETENV("HOMEPATH") you should use GETENV("USERPROFILE")
that returns drive + path.
SYS(5) returns the current Visual FoxPro default drive than has nothing to do
with the HOMEPATH location.
In some installation they probably are the same, but expect more configuration
where it is not.
Gianni
On Tue, 6 Apr 2021 13:56:25 -0400, "MB Software Solutions, LLC"
<[email protected]> wrote:
I get this error when executing a COPY TO .... TYPE XL5 line in a
program designed over a decade ago: /OLE error code 0x80030003: Unknown
COM status code. /
Interesting. I remoted into the guy's computer. He said it's a fairly
new laptop (3 months old?) and it's version is 2102 (Build
13801.20360). I fired up vRunFox.exe and did a simple xx =
CREATEOBJECT("Excel.Application") and it worked fine. What's strange to
me is that the line throwing that Error 1426 is not an Excel automation
line, but the COPY TO line. I believe the problem is the lcFile
variable. When this code was written, Vista was the latest operating
system. You can see how I look at the OS() to select the proper area
for My Documents.
*** mjb 03/03/2010 - changed for Vista and beyond
IF VAL(SUBSTR(OS(),9,1)) >= 6 THEN && Vista doesn't use My
lcDir = SYS(5) + ADDBS(GETENV("HOMEPATH")) +
"Documents\"
ELSE && XP and below use My
lcDir = SYS(5) + ADDBS(GETENV("HOMEPATH")) + "My
Documents\"
ENDIF
lcFile = ADDBS(lcDir) + "Inventory_" + DTOC(DATE(),1)
*** mjb 06/26/2017 - added nbrdft, ntotbf
IF this.lShowZeroQty THEN
COPY TO (lcFile) FIELDS ccompany, cpalletsize,
cdescription, nqtyonhand, nprice, ntotvalue, nbrdft, ntotbf FOR
this.CustomerSelected(icustid) TYPE XL5
ELSE
COPY TO (lcFile) FIELDS ccompany, cpalletsize,
cdescription, nqtyonhand, nprice, ntotvalue, nbrdft, ntotbf FOR
this.CustomerSelected(icustid) AND nQtyOnHand > 0 TYPE XL5
ENDIF
So in short, I think the fact that it's Error 1426 is misleading...I
doubt it's an Excel problem at all but in fact a problem with that
lcFile actual path derived.
I think somebody recently mentioned a Doug Hennig bit of code to look at
the user's ACTUAL path to his documents area, iirc? I'll dig for that
later after an appt but wanted to throw this out there in the meanwhile
in case others have the "I had that happen to me and this is how I fixed
it!" kind of memory recall. ;-)
tia,
--Mike
_______________________________________________
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/[email protected]
** 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.