¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

February Meeting


P.J. Fernandez
 

Talked about:

1. Wine VFP (file added to the file area)
2. Outlook Automation (How to send spam!)

****
#DEFINE EmailItem 0
#DEFINE OutboxFolder 4

LOCAL oOutlook, oMessage, oAttachment, oOutboxFolder, oOutlookSpace
LOCAL llHotmail, lcFileName, lcText, lnOutboxItems, lnBytes, lcTempFileName, lcTempText
LOCAL lcLeadsTable, lnLatestBatch, lnRand, lcHTMLBody

CLOSE DATA ALL

lcTable = [RF_Announce]

lnRand = INT( RAND( -1 ) )
oOutlook = CreateObject( "Outlook.Application" )
IF VARTYPE( oOutlook ) # [O]
MESSAGEBOX( [Error creating Outlook object. Quitting ....] )
RELEASE oMessage, oOutlook, oAttachment, oOutlookFolder, oOutlookSpace
RETURN
ENDIF

SET MEMOWIDTH TO 2000

IF USED( [Announce] )
USE IN Announce
ENDIF

USE ( lcTable ) IN 0 SHARED ALIAS Announce
SELECT Announce
LOCATE

lcHTMLBody = FILETOSTR( [Announcement.htm] )

SCAN
oMessage = oOutlook.CreateItem( EmailItem )
IF VARTYPE( oMessage ) # [O]
MESSAGEBOX( [Error creating Outlook's Message object. Quitting ....] )
LOOP
ENDIF

oMessage.To = ALLTRIM( announce.Address )
oMessage.Subject = "Hires Marketing Executive"

oMessage.HTMLBody = lcHTLMBody

oMessage.SEND( )
oMessage = .F.

lnRand = INT( 7 * RAND( ) ) + 1
WAIT WINDOW [Waiting some time before processing the next one....];
+ ALLTRIM( announce.Address ) TIMEOUT ( lnRand )
ENDSCAN


RELEASE oMessage, oOutlook, oAttachment, oOutlookFolder, oOutlookSpace
**
3. Excel Automation $#&^%#&% Frustration *&&^%*$^%R*&@@@@@

CLEAR ALL

SET STEP ON

#Include excel9.h
#DEFINE False .F.
#DEFINE True .T.

loExcel = CREATEOBJECT("Excel.Application")
loExcel.SheetsInNewWorkbook = INT(1)
loWorkBook = loExcel.WorkBooks.Add
loExcel.Visible = .T.
loSheet = loExcel.Sheets(1)
loSheet.NAME = [MadFox]
loSheet.Cells(1,1).Value = [Test]
loSheet.Cells(1,2).Value = 3
loSheet.Cells(2,1).Value = [Test2]
loSheet.Cells(2,2).Value = 8
lcRange = [A1:B2]
loSheet.Range( lcRange ).Copy
*loExcel.CutCopyMode = .F.
loSheet.Range("A5").Select

SET STEP ON

*loSheet.Range("A5").PasteSpecial( xlPasteAll, xlPasteSpecialOperationNone, False, True )
*loSheet.Range("A5").PasteSpecial( xlAll, xlNone, False, True)


RELEASE ALL

*PJ* Sub Macro1()
*PJ* '
*PJ* ' Macro1 Macro
*PJ* ' Macro recorded 2/17/2004 by fernanpf
*PJ* '

*PJ* '
*PJ* Range("A1:B2").Select
*PJ* Selection.Copy
*PJ* Range("A5").Select
*PJ* Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
*PJ* , Transpose:=True
*PJ* End Sub

4. TextPad editor for Java programming.

5. View Definition brings h files into view. (VFP 8.0)

6. Mover Class - see file on the website.

Thanks for coming... We enjoyed the cake very much!

P.J & the rest of the gang....


Stein Goering
 

For what it's worth...

The code below runs without error:
**
CLEAR ALL
*SET STEP ON
*#Include excel9.h
#DEFINE False .F.
#DEFINE True .T.
*#Include excel9.h
#DEFINE False .F.
#DEFINE True .T.

loExcel = CREATEOBJECT("Excel.Application")
loExcel.SheetsInNewWorkbook = INT(1)
loWorkBook = loExcel.WorkBooks.Add
loExcel.Visible = .T.
loSheet = loExcel.Sheets(1)
loSheet.NAME = [MadFox]
loSheet.Cells(1,1).Value = [Test]
loSheet.Cells(1,2).Value = 3
loSheet.Cells(2,1).Value = [Test2]
loSheet.Cells(2,2).Value = 8
lcRange = [A1:B2]
loSheet.Range( lcRange ).Copy
lcClip = _CLIPTEXT
loExcel.CutCopyMode = .F.
loSheet.Range("A5").Select
*SET STEP ON
_CLIPTEXT = lcClip
losheet.Range("a5").PasteSpecial(-4104,-4142,0,1)
RELEASE ALL
***

Unfortunately, it does not produce the desired result as the pasted cells
are NOT transposed. It appears there is an issue with how Excel and Foxpro
use the copy buffer memory, and we can avoid the PasteSpecial property error
if we load the clipboard with a plain Foxpro string. (Remember during our
meeting trials every once in a while we got some text to paste into the
worksheet, but it always happened after we had done some copy/paste in
Foxpro, thus overwriting the clipboard.) By copying the cliptext to a
variable and then reading it back, I seem to have circumvented the memory
space issue. However, in the process we evidently loose whatever
information Excel needs to perform the transposition and we end up with an
exact copy of the original range. Leaving us in a Catch-22.

Maybe Jim's idea of creating and executing an Excel macro is the way to go??

On another point, you'll notice that I used the literal values rather than
the include file definitions because I could not locate a copy of excel9.h
I had assumed that somewhere in the MS KB it would tell me where to download
it, but not so. Google turned up references to using it, but not to
obtaining it. Neither could I find it in my installation of VS.Net. How
the hell does one get a copy?

--stein

Stein Goering
Arbutus Computer Services
17494 Merry Hill Rd
Richland Center, WI 53581

608.538.3820


Stein Goering
 

As discussed in last meeting:
4. TextPad editor for Java programming.


I noticed that this product was also featured in Jan 04 Foxpro Advisor tips
section -- how to configure textpad to work with VFP.

Having said that, my personal choice remains freeware editor PSPad.

I still use integrated editor for VFP work, but have my system configured so
PSPad replaces Notepad as default editor.


--stein

Stein Goering
Arbutus Computer Services
17494 Merry Hill Rd
Richland Center, WI 53581

608.538.3820


 

¿ªÔÆÌåÓý

Stein:
?
Thanks for the tip.? I downloaded both and on initial use - agree that PSPad is better.? I'm doing some Java stuff and needed something more than NOTEPAD.? Thanks!
?
Peter D.

As discussed in last meeting:
4.? TextPad editor for Java programming.
http://www.textpad.com/download/#downloads

I noticed that this product was also featured in Jan 04 Foxpro Advisor tips
section -- how to configure textpad to work with VFP.?

Having said that, my personal choice remains freeware editor PSPad.
http://www.pspad.com/index_en.html
I still use integrated editor for VFP work, but have my system configured so
PSPad replaces Notepad as default editor.


--stein

Stein Goering
Arbutus Computer Services
17494 Merry Hill Rd
Richland Center, WI? 53581

608.538.3820