+ Reply to Thread
Results 1 to 8 of 8

Operating other programs with a macro

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    OH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Operating other programs with a macro

    I want to create a macro that will copy cells then open MSPAINT paste them and save them as 1.jpg then close Paint.
    select the next tab and copy; open paint; paste; save as 2.jpg.

    What I'm trying to accomplish is a digital white board where updates can be made to the spreadsheet, and a macro button hit to populate these jpgs, that can then be shown as a slide show using the screansaver on the PC.

    I'm up for other solutions, but I would still like to know how to open an other program, paste (in the other program), save as (in the other program)and close. I realize that if the save as function is used and the same name is used every time, that there may be an override box appear, and that is okay.

    Thanks

    Chad

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Operating other programs with a macro

    Hi,
    I spent ages trying to find a way of using a macro to copy to paint. Unfortunatley you cant use send keys to paste to paint.
    However this works!
    Basically, create a chart, copy the selected range to the chart, and then save as a jpeg. then delete the chart.
    Just need to change to your range, and change the file location & file name that you want to use


    HTML Code: 
    Regards
    Sean

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Operating other programs with a macro

    Sorry, not sure if that looks right.

    Please Login or Register  to view this content.
    regards Sean

  4. #4
    Registered User
    Join Date
    10-10-2012
    Location
    OH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Operating other programs with a macro

    I have used macros before, but I'm new to VBA. I could not make that work.
    Is there a way to make it work using a shell comand? I was able to open paint with a shell comand, but i do not know how to make paint paste, save as, and close. Am I asking too much?
    Last edited by Chad Craig; 10-12-2012 at 09:18 AM.

  5. #5
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Operating other programs with a macro

    Paint is the one programme you cant do that with. Hence the vba code supplied.
    Why would it not work?
    Can you add a workbook and maybe i can add it for you?

    regards
    Sean

  6. #6
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Operating other programs with a macro

    try this example.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-10-2012
    Location
    OH, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Operating other programs with a macro

    Thanks Sean,
    I have been playing with this. I couldn't get the jpg to save in my documents, so i went back and tried the code that you sent in message #3. I can get it to work on each individual page, but when i try to combine to one button (commandbutton2), i get an error. is there a way to combine the code so that pushing one button will exicute each of the 3 individual codes? I tried to record a macro where i went in and presses each button, but that didn't work. Attached is the worksheet with 3 tabs that need to be saved as jpgs.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Operating other programs with a macro

    You were getting an error as you need to change the RngExp for each different range you are adding to the chart.

    I have ammended your code. Tried it it on my pc all works ok.

    Regards
    Sean
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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