Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate sending message? 1

Status
Not open for further replies.

Noor2000

Technical User
May 23, 2004
78
CA
Hi every body,
I have two questions about Groupwise 6.5:
1-I have some operation that sould be done on a weekly, bi-monthly, or monthly, I would like to setup a message to remind me when I have to do that: Like I receive on each monday a message "Weekly operation", The first of every month I will receive a message "Monthly operation"

2-This is more tricky, I run a script which generates a text file and I would like this file to be sent automatically to some persons

Is it possible
Thank you for any help
Noor(TechnicalUser)
 
2- what program are you using to generate the text file? You may be able to just use .sendmail in VBA.

If you need more options than .sendmail offers, I have code that I use to send emails from Excel VB that allows me to control the from text, body text and attachments as well as the subject.



John

Every generalization is false, including this one.
 
hi john,
I use a batch file, I don't know If it is going to work in that case, I don't know much in programming
Thanks
Noor
 
For part 1, see thread12-910605. That is actually the really tricky part of your question.

You could set up a Task item on you calendar for each Monday or whatever. That's easy to do on a recurring basis. You only set it up once but it appears every week. Unfortunately, emails cannot be set up this way. [thumbsdown]

Back to part 2:
Don't worry; I'm no programmer, either. But you can probably significantly shorten the time these processes are taking you.

You can call a macro from within a batch file.... A quick google search turned up this link.

If you're interested in proceeding let me know. I'd be happy to help you by providing code and helping you get it in place.


John

Every generalization is false, including this one.
 
Hi Jhon,
Thank you for proposing to help me, Yes I would like to set
this, I saw the link. Now when I run the script I know the name of the file is: accounts.txt, I know its location so which macro am I going to use to send this file to the persons I want?

Thanks
Noor
 
Sorry for the slow response...hectic day here at work.

Here's a snippet of code.... It might need a bit of tweaking, but we'll get to that soon enough.

I've added comments to help explain what each bit is doing.
Code:
Sub Send_Mail()
Dim FromText, BodyOfEmail, SubjText, MyRecipient
Dim objGW As GroupwareTypeLibrary.Application

SubjText = "Type your desired subject text here"

FromText = "Auto Generated Email - Please Do Not Reply" & _
"                                                     " & _
"                                                     " & _
"                                                     "
[green]'The extra spaces are to hide the actual sender.
'NOTE: recipient can still easily discover the actual sender by going to Properties[/green]

MyRecipient = "recipient1@somewhere.com"

BodyOfEmail = "This is where you type the text you want to appear in the body of your email.  " & _
    "If you want to force a return in your body text, use CHR(10) like this:" & Chr(10) & Chr(10) & _
    Chr(9) & "See?  The CHR(9) tabs over once."

Set objGW = New GroupwareTypeLibrary.Application [green]'opens connection with Groupwise[/green]

With objGW
  With .Login
[green]'I always make sure that I'm already logged in to Groupwise on the station running this code
'Code can be run with the workstation locked to maintain security.[/green]

    With .MailBox.Messages.Add(Class:="GW.MESSAGE.MAIL") [green]'Create new email message[/green]
    .Subject.PlainText = SubjText [green]'Add subject text[/green]
    .Bodytext.PlainText = BodyOfEmail [green]'Add body text[/green]
    .Attachments.Add "C:\Directory Path\accounts.txt" [green]'Add attachment[/green]
    .FromText = strFrom [green]'Add from text[/green]
    .Recipients.Add MyRecipient
    .Send [green]'Send email[/green]
    End With
  End With
  .Quit
End With

End Sub
With Excel Open, press <ALT>+F11 to open the VB Editor (VBE). Press <CTRL>+R to open Project Explorer (The Windows Explorer-looking thing to the left). Right click and choose Insert>Module. Copy and paste the code above.

Then, at the top of the page, go to Tools>References and check the box beside "GroupWare type library".

I would set yourself as the only recipient and try the code.

Let me know how it works.

John

Every generalization is false, including this one.
 
Hi Jhon,
Well I did what you told me but I don't understand what they mean by before running JMBAT, I have:
Please make sure that Journal Macro is running when JMBAT is called
Because I got an error message that he didn't recgnize JMBAT
Thanks for your help
Noor
 
To tell you the truth, I've never combined a macro with a batch file. The point of the link is that it can be done.

It sounds like you have a functioning batch file. The next step should be to get the macro running.

Copy the code I posted and paste into a module as described in my earlier post. Name yourself as the only recipient. Try running the code to be sure it works.



John

Every generalization is false, including this one.
 
It should be a silly question, but how you execute a module from Excell?
Thanks
 
With Excel open, go to Tools>Macro>Macros

This will bring up a dialog box listing all available macros. Highlight the one you want and click on "Run".

I'd suggest making sure that there is nothing else in the workbook that you want and save the workbook with a name like SendEmail.xls. If you save it to a network drive, you'll be able to access it later from your batch file.

One more question here: who wrote the batch file?


John

Every generalization is false, including this one.
 
anotherhiggins - thanks for the code - Can I do this with Word? My goal is to have a MS Word macro create and send an email with a canned message to a specific recipient. So nothing fancy - just send an e-mail. Question - how do you load the Add-in "GroupWare type library"? Where do you find the code for this? A DLL? From Novell?
Thanks
 
You can call any COM function through WSH.
Here is an example:

Dim objMessage, objConfig
set objMessage = createobject("cdo.message")
set objConfig = createobject("cdo.configuration")

set flds = objConfig.Fields
flds.Item(" = 2
flds.Item(" = "localhost"
flds.Update

set objMessage.Configuration = objConfig
objMessage.To = "jones@jones.com"
objMessage.From = "your@mama.com"
objMessage.Subject = "subject"
objMessage.TextBody = "some text"
objMessage.fields.update
objMessage.Send

set objMessage = nothing
set objConfig = nothing

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top