Email copy and paste everynight at a certain time ?

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,079
Office Version
  1. 365
Platform
  1. Windows
Hi what I am trying to do is. I want to leave my excel book open and outlook open. Everynight if possible I want to run this macro below paste it to a new email with email address example: JOhnl.com; and send it a like 3:45 AM eastern time. Then close the book dfgdrg.xlsx possible?


Code:
Sub Mac()
ChDir "C\Users\Documents\16-Jun\06-29-2016

Workbooks.OpenFilename:=_

"C:\Users\Documents\16-Jun\06-29-2016\dfgdrg.xlsx"

Range("A1:H4).copy

End Sub()
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Last edited:
Upvote 0
hi can anyone help me finish this macro then i can test it using
application.ontime.
Code:
[LEFT][COLOR=#333333][FONT=monospace]Sub Mac()
ChDir "C\Users\Documents\16-Jun\06-29-2016

Workbooks.OpenFilename:=_

"C:\Users\Documents\16-Jun\06-29-2016\dfgdrg.xlsx"

Range("A1:H4).copy

End Sub()[/FONT][/COLOR][/LEFT]

This above opens book and copy's range.

The next step I need is to paste is to New email in outlook then add email address lets say johnl.com also in the subject "Numbers" and hit send. Once I get to this then I can test and try to get
application.ontime to work.

Any help would be great

Im not saying below is some of the answer, but I feel some of it makes sense if I have to open outlook and get that to work somehow.

Code:
    Workbooks(fileName).Activate
        
    Emails =
    LowerFileName = StrConv(fileName, vbLowerCase)
    
   
        
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    
    With OutMail
        .Display
    End With
    Signature = OutMail.HTMLBody
    With OutMail
        .To = Emails
        .Cc =
        .Subject = Numbers
        .Attachments.Add fpath
        .HTMLBody = Strategy & "<br /><br />" & Signature
  
End Sub
 
Last edited:
Upvote 0
Hi anyone can help me on this. If i am not explainging it right. Ill try and explain it again thanks
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top