FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour I require some work done - eMail Merge Feature
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
I require some work done - eMail Merge Feature
Posted: Tue Jul 15, 2008 08:55 AM

Hi guys,

I have written a small database application with FWH and xHarbour. Its a basic CRM and quoting system.

I need to add the functionaliy to be able to send bulk emails to the database by merging certain datafields.

i.e. Dear <<title>> <<surname>> etc.

Where I need the help is the editor - I would like the user to be able to create the email within the program. (Change fonts, insert pics etc.)

Naturally, I am prepared to pay for the feature or the components that can enable the feature to be added into my program.

You can contact me on: ollie @ theoasis.co.za

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: I require some work done - eMail Merge Feature
Posted: Tue Jul 15, 2008 10:15 AM

You can use Word.

EMG

Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
I require some work done - eMail Merge Feature
Posted: Tue Jul 15, 2008 10:41 AM

I'm sure I could. Could it still be done within the confines of my program?

OLE etc?

I need more guidance on this. Sample code etc. If I had the time, I could possibly figure it out, but I need a solution quickly.

Could you elaborate on the solution you suggest?

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
I require some work done - eMail Merge Feature
Posted: Tue Jul 15, 2008 11:58 AM
This is a working sample:

FUNCTION MAIN()

    LOCAL oWord := CREATEOBJECT( "Word.Application" )

    LOCAL oDoc := oWord:Documents:Add()

    LOCAL oSel

    oDoc:Range:InsertAfter( "<toreplace>" + CHR( 13 ) )

    oDoc:Select()

    oSel = oWord:Selection

    WORDREPLACE( oSel, "<toreplace>", "Giordano Enrico Maria" )

    oWord:Visible = .T.

    RETURN NIL


FUNCTION WORDREPLACE( oSel, cSrc, cRpl )

    oSel:Start = 0
    oSel:End = -1

    oSel:Find:Execute( cSrc )

    oSel:Range:Text = cRpl

    RETURN NIL


EMG
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
I require some work done - eMail Merge Feature
Posted: Tue Jul 15, 2008 12:15 PM

Wow! Thats was easy!

Where can I find other commands to:

  1. Open an exisiting document to do the replace on.

Thanks so far!

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
I require some work done - eMail Merge Feature
Posted: Tue Jul 15, 2008 12:36 PM

Search you hard disk or the Office CD for vba*.chm.

EMG

Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 08:43 AM

Hi Enrico,

is it possible to give an easy example that opens a word document and print it.

Thanks,

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 11:13 AM
FUNCTION MAIN()

    LOCAL oWord := CREATEOBJECT( "Word.Application" )

    LOCAL oDoc := oWord:Documents:Open( "E:\XHARBOUR\TEST.DOC" )

    oDoc:PrintOut( .F. )

    oDoc:Close( 0 )

    oWord:Quit()

    RETURN NIL


EMG
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 11:35 AM

Thanks Enrico,

It works very well.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 11:42 AM

Thank you. This is all very helpful.

  1. How would you do a Email merge though? Surely not with Word?

  2. And on the subject of merging with Word, how would you get it to replicate the document for each record in the Database

e.g. Dear Mr Jones
Bla Bla
----- New Page -----
Dear Mr Smith
Bla Bla
----- New Page -----
etc.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 12:01 PM
Ollie wrote:2. And on the subject of merging with Word, how would you get it to replicate the document for each record in the Database


Use InsertFile() method.

EMG
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 01:30 PM

You are a man of few words. :)

Is your response related to the Email part of my question or my "replicate" letter part of the email?

You are clearly knowledgable on the subject, and I clearly need a little more guidance. I appreciate that a forum such as this one is there to help each other on a community basis, but I need more specific help / code and am prepared to pay for your time.

As I've said I need to 1. Create an email template and 2. Send an email to the database using this template. (Using Office together with my software to achieve this is fine)

If you can help, please email me on ollie @ theoasis.co.za or on Skype Chat - ollieoasis

Thanks.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 03:21 PM
Ollie wrote:You are a man of few words. :-)


Yes, always. :-)

Ollie wrote:Is your response related to the Email part of my question or my "replicate" letter part of the email?


It is the answer to your point 2, as you can see in my quoting inside my previous message.

Ollie wrote:As I've said I need to 1. Create an email template and 2. Send an email to the database using this template. (Using Office together with my software to achieve this is fine)


Sorry, I don't know how to send emails from Word.

EMG
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 03:27 PM

It doesn't have to be from word. Is there another way to do it? I need the user to be able to design an email (nothing too fancy - basic functionality as in an Outlook express etc.) and then have that email sent to the database.

So I guess its an HTML Editor that I need that can plug in neatly into my app. Or is there a better way?

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
I require some work done - eMail Merge Feature
Posted: Wed Jul 16, 2008 03:33 PM

I don't know, sorry.

EMG