View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Oener Oener is offline
external usenet poster
 
Posts: 6
Default Get / Extract Data from an Excel Field

Private Sub C2_Click()
Dim ool As Outlook.Application
Dim myattachments As Variant
Dim oMail As Outlook.mailitem
Dim myattach As Variant
Dim mydate As Variant
Dim mymonth As Variant
Dim myyear As Variant
Dim body As String
Dim oSignatur As String
Set fso = CreateObject("Scripting.FileSystemObject")
Dim sSourcePath As String, sDestPath As String
Dim ofile As Variant

oSignatur = "Kindly" & Chr(13) & "Oener "

body = "Ladies and Gentlemen" & Chr(13) & Chr(13) _
& "please find attached the new listing of our estimated requirements." +
Chr(13) + oSignatur

Set ool = CreateObject("Outlook.Application")
Set oMail = ool.CreateItem(olMailItem)
Set myattachments = oMail.Attachments

oMail.body = body

mymonth = "02"
myyear = Format(Date, "yyyy")
mydate = mymonth & "." & myyear
oMail.Subject = "Forecast: " & mydate

myattach = "\\nbbnig01\"

oMail.To = Me.Range("C2").Value 'here should stay:
Me.Range(Button.Name).Value
ofile = "file.xls"

On Error Resume Next
myattachments.Add myattach & "\actuel\" & ofile
oMail.Recipients.ResolveAll
oMail.Display
sSourcePath = myattach & "\" & "\actuel\" & ofile
sDestPath = myattach & "\2005\February\" & ofile
fso.MoveFile sSourcePath, sDestPath
End SubOK here is the Code:

So you see here, neraly everthing is dynamic. only the Name of the field is
not.

So I hope that helps.

"OJ" wrote:

Hi
your english is much better but I'm still not sure I follow.....could
you post some more of your code? Is this in a Commandbutton_Click
event?
Cheers,
OJ