Re: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-09 Thread MB Software Solutions, LLC

The lcDocumentsPath code.

On 4/8/2021 3:44 PM, Frank Cazabon wrote:

Hey Mike, what exactly worked?

On 8 April 2021 13:34:30 GMT-04:00, "MB Software Solutions, LLC" 
 wrote:

Thanks, Frank and othersthat worked.


On 4/7/2021 8:52 AM, Frank Cazabon wrote:

Hi Mike,

have you worked this out yet?

On my Windows 10 PC, this line:

SYS(5) + ADDBS(GETENV("HOMEPATH")) + "Documents\"

gives me the correct path, however, maybe the sys(5) is returning the
incorrect drive? Possibly the documents folder is not in the same
folder as your default drive?

This is what I use to get the Documents folder:

#DEFINE CSIDL_PERSONAL 0x0005
LOCAL lcFolderPath, lcDocumentsPath
m.lcFolderPath = space(255)

DECLARE SHORT SHGetFolderPath IN SHFolder.dll ;
     INTEGER hwndOwner, INTEGER nFolder, INTEGER hToken, ;
     INTEGER dwFlags, STRING @pszPath

SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @m.lcFolderPath)

m.lcDocumentsPath = Alltrim(m.lcFolderPath)

m.lcDocumentsPath = SubStr(m.lcDocumentsPath,1,

Len(m.lcDocumentsPath)

- 1)
RETURN ADDBS(m.lcDocumentsPath)

Maybe another possibility is you are trying to copy more data than
Excel can handle (I can't remember the limit from that version) or
maybe there is bad data, like a date before 1/1/1900?

But then again, those last 2 issues would probably only occur when
actually trying to open the file in Excel.

FWIW I use this code for creating Excel files these days:

         loExcel = NEWOBJECT("VFPxWorkbookXLSX",

"VFPxWorkbookXLSX.vcx")

         loExcel.SaveTabletoWorkbook(m.lcTable, m.lcXLSFile, .T., .T.)

I believe the URL for this utility is:

https://github.com/ggreen86/XLSX-Workbook-Class

Doug Hennig has a paper here that may be helpful if you want to
consider alternatives:

https://doughennig.com/papers/Pub/201607dhen.pdf

Frank.

Frank Cazabon

On 06/04/2021 1:56 pm, MB Software Solutions, LLC 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






--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---


[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
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/24c11da9-5e85-14a8-3324-f21d717f2...@mbsoftwaresolutions.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.

Re: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-08 Thread Frank Cazabon
Hey Mike, what exactly worked?

On 8 April 2021 13:34:30 GMT-04:00, "MB Software Solutions, LLC" 
 wrote:
>Thanks, Frank and othersthat worked.
>
>
>On 4/7/2021 8:52 AM, Frank Cazabon wrote:
>> Hi Mike,
>>
>> have you worked this out yet?
>>
>> On my Windows 10 PC, this line:
>>
>> SYS(5) + ADDBS(GETENV("HOMEPATH")) + "Documents\"
>>
>> gives me the correct path, however, maybe the sys(5) is returning the
>
>> incorrect drive? Possibly the documents folder is not in the same 
>> folder as your default drive?
>>
>> This is what I use to get the Documents folder:
>>
>> #DEFINE CSIDL_PERSONAL 0x0005
>> LOCAL lcFolderPath, lcDocumentsPath
>> m.lcFolderPath = space(255)
>>
>> DECLARE SHORT SHGetFolderPath IN SHFolder.dll ;
>>     INTEGER hwndOwner, INTEGER nFolder, INTEGER hToken, ;
>>     INTEGER dwFlags, STRING @pszPath
>>
>> SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @m.lcFolderPath)
>>
>> m.lcDocumentsPath = Alltrim(m.lcFolderPath)
>>
>> m.lcDocumentsPath = SubStr(m.lcDocumentsPath,1,
>Len(m.lcDocumentsPath) 
>> - 1)
>> RETURN ADDBS(m.lcDocumentsPath)
>>
>> Maybe another possibility is you are trying to copy more data than  
>> Excel can handle (I can't remember the limit from that version) or 
>> maybe there is bad data, like a date before 1/1/1900?
>>
>> But then again, those last 2 issues would probably only occur when 
>> actually trying to open the file in Excel.
>>
>> FWIW I use this code for creating Excel files these days:
>>
>>         loExcel = NEWOBJECT("VFPxWorkbookXLSX",
>"VFPxWorkbookXLSX.vcx")
>>         loExcel.SaveTabletoWorkbook(m.lcTable, m.lcXLSFile, .T., .T.)
>>
>> I believe the URL for this utility is:
>>
>> https://github.com/ggreen86/XLSX-Workbook-Class
>>
>> Doug Hennig has a paper here that may be helpful if you want to 
>> consider alternatives:
>>
>> https://doughennig.com/papers/Pub/201607dhen.pdf
>>
>> Frank.
>>
>> Frank Cazabon
>>
>> On 06/04/2021 1:56 pm, MB Software Solutions, LLC 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
>>>
>>>
>>>
>>>
>>
>>
>> --- StripMime Report -- processed MIME parts ---
>> multipart/alternative
>>  text/plain (text body -- kept)
>>  text/html
>> ---
>>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
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/ee06c5c4-4eb3-41ec-b928-6f373e916...@gmail.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 

Re: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-08 Thread MB Software Solutions, LLC

Thanks, Frank and othersthat worked.


On 4/7/2021 8:52 AM, Frank Cazabon wrote:

Hi Mike,

have you worked this out yet?

On my Windows 10 PC, this line:

SYS(5) + ADDBS(GETENV("HOMEPATH")) + "Documents\"

gives me the correct path, however, maybe the sys(5) is returning the 
incorrect drive? Possibly the documents folder is not in the same 
folder as your default drive?


This is what I use to get the Documents folder:

#DEFINE CSIDL_PERSONAL 0x0005
LOCAL lcFolderPath, lcDocumentsPath
m.lcFolderPath = space(255)

DECLARE SHORT SHGetFolderPath IN SHFolder.dll ;
    INTEGER hwndOwner, INTEGER nFolder, INTEGER hToken, ;
    INTEGER dwFlags, STRING @pszPath

SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @m.lcFolderPath)

m.lcDocumentsPath = Alltrim(m.lcFolderPath)

m.lcDocumentsPath = SubStr(m.lcDocumentsPath,1, Len(m.lcDocumentsPath) 
- 1)

RETURN ADDBS(m.lcDocumentsPath)

Maybe another possibility is you are trying to copy more data than  
Excel can handle (I can't remember the limit from that version) or 
maybe there is bad data, like a date before 1/1/1900?


But then again, those last 2 issues would probably only occur when 
actually trying to open the file in Excel.


FWIW I use this code for creating Excel files these days:

        loExcel = NEWOBJECT("VFPxWorkbookXLSX", "VFPxWorkbookXLSX.vcx")
        loExcel.SaveTabletoWorkbook(m.lcTable, m.lcXLSFile, .T., .T.)

I believe the URL for this utility is:

https://github.com/ggreen86/XLSX-Workbook-Class

Doug Hennig has a paper here that may be helpful if you want to 
consider alternatives:


https://doughennig.com/papers/Pub/201607dhen.pdf

Frank.

Frank Cazabon

On 06/04/2021 1:56 pm, MB Software Solutions, LLC 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







--- StripMime Report -- processed MIME parts ---
multipart/alternative
 text/plain (text body -- kept)
 text/html
---


[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
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/70525bb6-d28c-16c1-f614-b85633c32...@mbsoftwaresolutions.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.

Re: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-07 Thread Frank Cazabon

Hi Mike,

have you worked this out yet?

On my Windows 10 PC, this line:

SYS(5) + ADDBS(GETENV("HOMEPATH")) + "Documents\"

gives me the correct path, however, maybe the sys(5) is returning the 
incorrect drive? Possibly the documents folder is not in the same folder 
as your default drive?


This is what I use to get the Documents folder:

#DEFINE CSIDL_PERSONAL 0x0005
LOCAL lcFolderPath, lcDocumentsPath
m.lcFolderPath = space(255)

DECLARE SHORT SHGetFolderPath IN SHFolder.dll ;
    INTEGER hwndOwner, INTEGER nFolder, INTEGER hToken, ;
    INTEGER dwFlags, STRING @pszPath

SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, @m.lcFolderPath)

m.lcDocumentsPath = Alltrim(m.lcFolderPath)

m.lcDocumentsPath = SubStr(m.lcDocumentsPath,1, Len(m.lcDocumentsPath) - 1)
RETURN ADDBS(m.lcDocumentsPath)

Maybe another possibility is you are trying to copy more data than  
Excel can handle (I can't remember the limit from that version) or maybe 
there is bad data, like a date before 1/1/1900?


But then again, those last 2 issues would probably only occur when 
actually trying to open the file in Excel.


FWIW I use this code for creating Excel files these days:

        loExcel = NEWOBJECT("VFPxWorkbookXLSX", "VFPxWorkbookXLSX.vcx")
        loExcel.SaveTabletoWorkbook(m.lcTable, m.lcXLSFile, .T., .T.)

I believe the URL for this utility is:

https://github.com/ggreen86/XLSX-Workbook-Class

Doug Hennig has a paper here that may be helpful if you want to consider 
alternatives:


https://doughennig.com/papers/Pub/201607dhen.pdf

Frank.

Frank Cazabon

On 06/04/2021 1:56 pm, MB Software Solutions, LLC 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







--- StripMime Report -- processed MIME parts ---
multipart/alternative
 text/plain (text body -- kept)
 text/html
---

___
Post Messages to: ProFox@leafe.com
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/466d4767-bccb-ade1-0d65-32e5f29fe...@gmail.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.

RE: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-06 Thread Richard Kaye
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..7423 for Windows
*Notes: illustrates how to use SHSpecialFolder and SaveFilename
**
#INCLUDE \vfp2c.h 
#INCLUDE \rkdev.h
TRY 
ACTIVATE SCREEN
CLEAR
IF NOT [vfp2c32]$LOWER(SET("Library"))
SET LIBRARY TO \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  On Behalf Of Richard Kaye
Sent: Tuesday, April 6, 2021 5:49 PM
To: profoxt...@leafe.com
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  On Behalf Of MB Software 
Solutions, LLC
Sent: Tuesday, April 6, 2021 1:56 PM
To: profoxt...@leafe.com
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 

RE: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-06 Thread Richard Kaye
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  On Behalf Of MB Software 
Solutions, LLC
Sent: Tuesday, April 6, 2021 1:56 PM
To: profoxt...@leafe.com
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: ProFox@leafe.com
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/c74e20a6-e5fd-9cb0-07f4-7ee1bdf56...@mbsoftwaresolutions.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/c74e20a6-e5fd-9cb0-07f4-7ee1bdf56...@mbsoftwaresolutions.com
___
Post Messages to: ProFox@leafe.com
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.

Re: Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-06 Thread Gianni Turri
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" 
 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: ProFox@leafe.com
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/vlip6ghr30d5okten76tos9jiuvmdsk...@4ax.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.


Interesting Error 1426 on COPY TO (lcFile) FIELDS a, b, c FOR condition TYPE XL5

2021-04-06 Thread MB Software Solutions, LLC
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: ProFox@leafe.com
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/c74e20a6-e5fd-9cb0-07f4-7ee1bdf56...@mbsoftwaresolutions.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.