+ Reply to Thread
Results 1 to 3 of 3

Macro to copy an image and create a file does not work when run automatically through VBS

  1. #1
    Registered User
    Join Date
    04-14-2019
    Location
    Singapore
    MS-Off Ver
    Office 365
    Posts
    20

    Macro to copy an image and create a file does not work when run automatically through VBS

    Hi ,

    I have a macro to create an image file and then attach it to a mail in outlook . The macro runs fine when I run it manually . However I have a requirement to send the same on a mail at 4 am and for that I have created a VBS file to run the same at 4 AM through Windows scheduler. However when it is run automatically at 4 AM the macro does not wok and mail is sent without an image. First I thought it was a issue with my Mail macro but the issue I found that the range when copy and pasted as graph and then exported it to image file is not working when runs automatically . Looks like the VBS scheduler runs faster and does not either copy the range or paste or fails to export. I tried to put Application.Wait also after copy and after paste but the problem is still there. The image file is created blank.

    Can anyone help?

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Macro to copy an image and create a file does not work when run automatically through

    While vbscript is similar to VBA, this is a VBA macros forum. Why not use VBA? If this were, I would say post the code.

    For those sorts of things, I put a popup msgbox in the open event. If no response, it closes the Windows Scheduler workbook, runs the macro, and closes the workbook. If I respond to the msgbox, it skips the macro so I can edit the file.

    e.g. In ThisWorbook object:
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 09-08-2019 at 11:27 AM.

  3. #3
    Registered User
    Join Date
    04-14-2019
    Location
    Singapore
    MS-Off Ver
    Office 365
    Posts
    20
    Hi

    Thanks a lot !

    Let me send you the code I am using in vba . The problem is when this macro is called through VBS file the image is not created specially when run in night when the task is scheduled. The code is as follows
    Please Login or Register  to view this content.
    Last edited by davesexcel; 09-23-2021 at 05:20 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. macro create file copy
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-19-2019, 12:09 PM
  2. Macro to Open File/s and copy data won't work
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2019, 01:16 AM
  3. macro to just automatically open the pdf file in a location and copy it and paste in XL
    By catchnanan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-29-2018, 09:29 AM
  4. Macro to create a copy of XlSB file and save as XLSX file without any formulas.
    By Mysore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2016, 03:11 AM
  5. [SOLVED] Macro to copy the data from a closed file to another work book using filters
    By Kiran Kurapati in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2014, 12:50 PM
  6. Need help to create a macro to automatically copy in one sheet and copy in the other
    By Thammiraju in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2014, 09:36 PM
  7. Macro to create copy of a .xls file (Beginner)
    By Yaz Patel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2008, 10:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1