I require some work done - eMail Merge Feature

Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

I require some work done - eMail Merge Feature

Post by Ollie »

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)
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

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)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

This is a working sample:

Code: Select all

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
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

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)
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Post by Horizon »

Hi Enrico,

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

Thanks,
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Code: Select all

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
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Post by Horizon »

Thanks Enrico,

It works very well.
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

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)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

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)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

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)
Post Reply