如何在VBA中安排将邮件传递到特定时间

时间:2016-08-12 09:12:43

标签: vba excel-vba outlook-vba excel

如何安排将邮件递送到VBA中的特定时间

生成邮件的代码

Set olApp = CreateObject("Outlook.application")
Set olItem = olApp.CreateItem(0)
olItem.display
olItem.To = "bhagyashri.kulkarni@mindtree.com"
olItem.Subject = "Auto Generated - Consolidated Task Tracking Report"
olItem.htmlbody = Join(aBody, vbNewLine)
olItem.Attachments.Add outputFileName
olItem.display

DeferredDeliveryTime会有用吗?怎么用?

1 个答案:

答案 0 :(得分:4)

我太好奇了,不回答这个问题。这段代码应该可行。

.DeferredDeliveryTime

可悲的是,public final class RxSequenceAnimation { private static final int[] PNG_RESOURCES = new int[]{ R.drawable.sequence_frame_00, R.drawable.sequence_frame_01, R.drawable.sequence_frame_02 }; private static final String TAG = "rx-seq-anim"; private final Resources mResource; private final ImageView mImageView; private final byte[][] RAW_PNG_DATA = new byte[PNG_RESOURCES.length][]; private final byte[] buff = new byte[1024]; private Subscription sub; public RxSequenceAnimation(Resources resources, ImageView imageView) { mResource = resources; mImageView = imageView; } public void start() { sub = Observable .interval(16, TimeUnit.MILLISECONDS) .map(new Func1<Long, Bitmap>() { @Override public Bitmap call(Long l) { int i = (int) (l % PNG_RESOURCES.length); if (RAW_PNG_DATA[i] == null) { // read raw png data (compressed) if not read already into RAM try { RAW_PNG_DATA[i] = read(PNG_RESOURCES[i]); } catch (IOException e) { Log.e(TAG, "IOException " + String.valueOf(e)); } Log.d(TAG, "decoded " + i + " size " + RAW_PNG_DATA[i].length); } // decode directly from RAM - only one full blown bitmap is in RAM at a time return BitmapFactory.decodeByteArray(RAW_PNG_DATA[i], 0, RAW_PNG_DATA[i].length); } }) .subscribeOn(Schedulers.newThread()) .onBackpressureDrop() .observeOn(AndroidSchedulers.mainThread()) .doOnNext(new Action1<Bitmap>() { @Override public void call(Bitmap b) { mImageView.setImageBitmap(b); } }) .subscribe(LogErrorSubscriber.newInstance(TAG)); } public void stop() { if (sub != null) { sub.unsubscribe(); } } private byte[] read(int resId) throws IOException { return streamToByteArray(inputStream(resId)); } private InputStream inputStream(int id) { return mResource.openRawResource(id); } private byte[] streamToByteArray(InputStream is) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int i; while ((i = is.read(buff, 0, buff.length)) > 0) { baos.write(buff, 0, i); } byte[] bytes = baos.toByteArray(); is.close(); return bytes; } } 仅适用于Outlook 2013之后,Siddarth Rout在评论中建议使用this VB驱动的方法。