The end of my day is coming and I'm getting distracted. Here's a little fun bit
I wrote a while back to get a bunch of potential values for the
SHSPecialFolders API call (sanitized for your protection, provided as is, no
guarantees...):
**************************************
* Program: SHSPECIALFOLDER1.prg
* Date: 07/01/2016 05:45 PM
* VFP Version: Visual FoxPro 09.00.0000.7423 for Windows
* Notes: illustrates how to use SHSpecialFolder and SaveFilename
**************************************
#INCLUDE <fix these paths for your system>\vfp2c.h
#INCLUDE <whaddayameanyoudon'thavemyincludefile>\rkdev.h
TRY
ACTIVATE SCREEN
CLEAR
IF NOT [vfp2c32]$LOWER(SET("Library"))
SET LIBRARY TO <set your path>\vfp2c32.fll ADDITIVE
ENDIF
LOCAL m.lcPath AS Character, m.lcResults AS Character
m.lcResults=[]
FOR m.lnI=1 TO 64
IF SHSPECIALFOLDER(m.lnI-1,@lcPath,.f.)
m.lcResults=m.lcResults+IIF(NOT
EMPTY(m.lcResults),CRLF,[])+ALLTRIM(TRANSFORM(m.lnI-1))+[ - ]+ALLTRIM(m.lcPath)
ELSE
ENDIF
NEXT
ASSERT .f. MESSAGE [Debug now?]
IF MESSAGEBOX([Save results to
file?],MB_YESNO+MB_ICONQUESTION,[Demonstrate SHSpecialFolder])=IDYES
*!* - rk - 2017-7-31 - use GetSaveFileName instead of putfile()
m.lcFile=GETSAVEFILENAME(0,[Text
Files]+CHR(0)+[*.txt],[SpecialFolders],[],[Save Special Folders File],0,[])
*!* m.lcFile=PUTFILE([Enter file
name:],[SpecialFolders],[txt])
STRTOFILE(m.lcResults,m.lcFile,0)
MODIFY FILE (m.lcFile)
ENDIF
CATCH TO m.loError
LOCAL m.lcError AS Character
m.lcError=[ Error: ] + STR(m.loError.ErrorNo) + CRLF
m.lcError=m.lcError+[ LineNo: ] + STR(m.loError.LineNo) + CRLF
m.lcError=m.lcError+[ Message: ] + m.loError.Message + CRLF
m.lcError=m.lcError+[ Procedure: ] + m.loError.Procedure + CRLF
m.lcError=m.lcError+[ Details: ] + m.loError.Details + CRLF
m.lcError=m.lcError+[ StackLevel: ] + STR(m.loError.StackLevel) + CRLF
m.lcError=m.lcError+[ LineContents: ] + m.loError.LineContents
MESSAGEBOX(m.lcError,MB_OK+MB_ICONSTOP,[*ERROR*])
FINALLY
ENDTRY
--
rk
-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Richard Kaye
Sent: Tuesday, April 6, 2021 5:49 PM
To: [email protected]
Subject: RE: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR
condition TYPE XL5
I'd look at using Win APIs to get that path. SHSPECIALFOLDERS in the vfp2c FLL
wraps that for you.
SET LIBRARY TO vfp2c32.fll
m.specialPath=[]
?SHSPECIALFOLDER(0x0005,@specialPath)
?m.specialPath
Some Windows API header file has all the values for that first parameter.
--
rk
-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of MB Software
Solutions, LLC
Sent: Tuesday, April 6, 2021 1:56 PM
To: [email protected]
Subject: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR
condition TYPE XL5
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
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
--- StripMime Report -- processed MIME parts --- multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
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.
Report [OT] Abuse:
http://leafe.com/reportAbuse/[email protected]
_______________________________________________
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/mwhpr1001mb21449d9e610341dbe2bfe48dd2...@mwhpr1001mb2144.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.
Report [OT] Abuse:
http://leafe.com/reportAbuse/mwhpr1001mb21449d9e610341dbe2bfe48dd2...@mwhpr1001mb2144.namprd10.prod.outlook.com
_______________________________________________
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/mwhpr1001mb2144ac64ae2d4fa35f14b96cd2...@mwhpr1001mb2144.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.