trekker123
Programmer
Here is the overall picture:
1. In Foxpro or other app, put on the clipboad the addressee, subject, body of message, attached file location & name in the formate described below.
2. Run a Visual Basic script that parses the clipboard text, generates and email, populates the email and attaches one file (I haben't figured out ho to attach more than one file).
DISCLAIMER: I'm not the world's best programmer, but here is how I do it. You will probably have to play around with the code a bit.
My Foxpro app places on the clipboard:
STORE ;
"GENERIC "+;
LEFT("&CTCDIR"+REPLI(" ",61),61)+;
LEFT("filename.txt"+REPLI(" ",50),50)+;
LEFT("Email subject here"+repl(" ",25),25)+;
LEFT("outlook addressee"+REPLI(" ",60),60)+;
"This is the text in th eemail body."+;
REPL(" ",100) TO _CLIPTEXT
The RUN the compiled VB app
The VB code:
Option Explicit
Dim Mail_Which
Dim SuperName
Dim Directory
Dim Directory2
Dim Email_to
Dim Other_info
Dim Filename
Dim PRNFile
Dim XLSFile
Dim AreaName
Dim txtAreaName
Dim EmailBody
Dim Subject
Dim Unused
Private Sub Form_Load()
ElseIf Mail_Which = "GENERIC" Then
'Email the checkout file to the PM from 'Boss'
Unused = Trim(Mid(Clipboard.GetText(vbCFText), 9, 8))
Filename = Trim(Mid(Clipboard.GetText(vbCFText), 78, 50))
Directory = Trim(Mid(Clipboard.GetText(vbCFText), 17, 60)) + Filename
Filename = Trim(Mid(Clipboard.GetText(vbCFText), 78, 50))
Subject = Trim(Mid(Clipboard.GetText(vbCFText), 128, 25))
Email_to = Trim(Mid(Clipboard.GetText(vbCFText), 153, 60))
EmailBody = Trim(Mid(Clipboard.GetText(vbCFText), 213, 700))
'Put the same data on the form to confirm the
'clipboard text was parsed OK
txtDirectory.Text = Directory
txtSuperName.Text = Filename
txtEmail_to.Text = Email_to
Call cmd_GENERIC_Click
ElseIf Mail_Which = "other possible formats" Then
yada yada yada
End If
'Remark the next statement and run the program, then
'you can see the form and the data that was parsed into
'the variables and placed on the form
Call Cmd_quit_Click
Private Sub cmd_GENERIC_Click()
'Mail the DOC files
Dim My01App, MyItem As Object
Dim MyAttachments, O1MailItem
Dim FileDate As Date
Set My01App = CreateObject("Outlook.Application"
Set MyItem = My01App.CreateItem(O1MailItem)
MyItem.Subject = Subject
MyItem.Body = Chr(11) + EmailBody + _
Chr(11) + Chr(11) + "sent: " & Now()
Set MyAttachments = MyItem.Attachments
MyAttachments.Add Directory, , 1
MyItem.to = Email_to
'review the email before sending it
MyItem.Display
'There is a command, or maybe delete the prior line
'send send te email without reviewing it.
End Sub
Private Sub Cmd_quit_Click()
Unload frmCTCemail
End Sub
1. In Foxpro or other app, put on the clipboad the addressee, subject, body of message, attached file location & name in the formate described below.
2. Run a Visual Basic script that parses the clipboard text, generates and email, populates the email and attaches one file (I haben't figured out ho to attach more than one file).
DISCLAIMER: I'm not the world's best programmer, but here is how I do it. You will probably have to play around with the code a bit.
My Foxpro app places on the clipboard:
STORE ;
"GENERIC "+;
LEFT("&CTCDIR"+REPLI(" ",61),61)+;
LEFT("filename.txt"+REPLI(" ",50),50)+;
LEFT("Email subject here"+repl(" ",25),25)+;
LEFT("outlook addressee"+REPLI(" ",60),60)+;
"This is the text in th eemail body."+;
REPL(" ",100) TO _CLIPTEXT
The RUN the compiled VB app
The VB code:
Option Explicit
Dim Mail_Which
Dim SuperName
Dim Directory
Dim Directory2
Dim Email_to
Dim Other_info
Dim Filename
Dim PRNFile
Dim XLSFile
Dim AreaName
Dim txtAreaName
Dim EmailBody
Dim Subject
Dim Unused
Private Sub Form_Load()
ElseIf Mail_Which = "GENERIC" Then
'Email the checkout file to the PM from 'Boss'
Unused = Trim(Mid(Clipboard.GetText(vbCFText), 9, 8))
Filename = Trim(Mid(Clipboard.GetText(vbCFText), 78, 50))
Directory = Trim(Mid(Clipboard.GetText(vbCFText), 17, 60)) + Filename
Filename = Trim(Mid(Clipboard.GetText(vbCFText), 78, 50))
Subject = Trim(Mid(Clipboard.GetText(vbCFText), 128, 25))
Email_to = Trim(Mid(Clipboard.GetText(vbCFText), 153, 60))
EmailBody = Trim(Mid(Clipboard.GetText(vbCFText), 213, 700))
'Put the same data on the form to confirm the
'clipboard text was parsed OK
txtDirectory.Text = Directory
txtSuperName.Text = Filename
txtEmail_to.Text = Email_to
Call cmd_GENERIC_Click
ElseIf Mail_Which = "other possible formats" Then
yada yada yada
End If
'Remark the next statement and run the program, then
'you can see the form and the data that was parsed into
'the variables and placed on the form
Call Cmd_quit_Click
Private Sub cmd_GENERIC_Click()
'Mail the DOC files
Dim My01App, MyItem As Object
Dim MyAttachments, O1MailItem
Dim FileDate As Date
Set My01App = CreateObject("Outlook.Application"
Set MyItem = My01App.CreateItem(O1MailItem)
MyItem.Subject = Subject
MyItem.Body = Chr(11) + EmailBody + _
Chr(11) + Chr(11) + "sent: " & Now()
Set MyAttachments = MyItem.Attachments
MyAttachments.Add Directory, , 1
MyItem.to = Email_to
'review the email before sending it
MyItem.Display
'There is a command, or maybe delete the prior line
'send send te email without reviewing it.
End Sub
Private Sub Cmd_quit_Click()
Unload frmCTCemail
End Sub