+ Reply to Thread
Results 1 to 5 of 5

COPY.PICTURE() and SAVE.AS.PICTURE() ???

  1. #1
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Rhode Island
    MS-Off Ver
    Excel for Mac 2011 and 2007 on PC
    Posts
    265

    COPY.PICTURE() and SAVE.AS.PICTURE() ???

    so I'm trying to export .png or .jpg of a range of cells.

    i started a thread in the general forum just looking for the way to do this without commands but just kept looking and came up with the COPY.
    PICTURE() command which takes a couple of arguments that dictate the appearance and size of the copy.

    following a few threads that talk about doing this manually, the next thing you would do is go to an empty sheet and paste the picture. it just goes right in the top corner of the sheet. then you can right click it and "Save As Picture" is available.

    I'm wondering if SAVE.AS.PICTURE() might be the function to duplicate that manual right clicking and selection and what arguments the function takes . . .

    thanks.

    brian

    PS I'm using all this in XLM speak. if there is a visual basic equivalent i usually can guess the translation to XLM with some trial and error and the arguments are probably arranged similarly. . .

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: COPY.PICTURE() and SAVE.AS.PICTURE() ???

    not quite sure what you are after
    you could copy and paste into MSPaint and saveas there

    if you want to do it via Macro
    Please Login or Register  to view this content.
    something like this ^

    just noted you are using MAC...i think the path address is done different though i am not entirely sure of the syntax
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Rhode Island
    MS-Off Ver
    Excel for Mac 2011 and 2007 on PC
    Posts
    265

    Re: COPY.PICTURE() and SAVE.AS.PICTURE() ???

    humdingaling: i think this is on the track.

    so XLM syntax for CopyPicture is COPY.PICTURE()

    I see that your route appears to be creating a chart. if i am parsing your code right you actually make the chart the dimension of the copied selection and then past the selection which was copied as a picture into it. then you use Chart.Export after activating that chart. i can't get formula builder to bite on any articulation of EXPORT.CHART() or CHART.EXPORT() and it doesn't recognize SAVE.AS.PICTURE() which is an actual command available.

    i absolutely suck at VBA but i guess i'll try to record a VBA macro of exporting a chart and see what the code looks like. and i'll do the same for Saving as Picture and see what i get. sometimes i can do this and kludge around to get where i want to go. not sure if i would be able to call a VBA macro out of one of my XLM approaches.
    I'm actually kind of surprised because SAVE.AS.PICTURE is an available command but you have to right click the element to get it. even COPY.PICTURE which is only available on a menu with a modifier key is available as a function. but can't find any functional form of SAVE.AS.PICTURE() which is a fairly direct way to do this image saving.

    i'll post what i get. thanks for the help.

  4. #4
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Rhode Island
    MS-Off Ver
    Excel for Mac 2011 and 2007 on PC
    Posts
    265

    Re: COPY.PICTURE() and SAVE.AS.PICTURE() ???

    unfortunately, i recorded a macro of right clicking the image and using the Save As Picture option from the right click response box and then just hit return taking the default title for the time being, and stopped recorded and went to the macro and there are only a couple lines with single apostrophe on each and no code . . .
    so maybe those aren't actions that can be recorded in VBA . . .

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: COPY.PICTURE() and SAVE.AS.PICTURE() ???

    what the code i provided does
    you highlight a selection (or you can change it to be a fixed range)
    copy that range as picture

    finds out where you want to save it via Application.FileDialog(msoFileDialogFolderPicker)
    if its a fixed location you can hard code it in and skip the need to find the location

    then it asks for the filename you want to save as
    you can automate this by using a reference of some sort bypassing the need for user input

    then the last bit of the code
    creates a chart but only adds the copied range into the chart
    exports chart into the file path and from the code prior

    most of that would not come out in "record a macro" unfortunately
    i suggest you cater the code to your need and create a shortcut key to the execution of the code

    i attached a variation on the above code
    its a fixed range and the filepath is the workbook path and the filename is drawn from cell K1
    to run the code i added shortcut CTRL+Q

    just open the file press ctrl q and a JPG will appear in the same location as the File
    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)

Similar Threads

  1. Copy an Image from a User form Picture Box to Worksheet Picture Box
    By sledgehammer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2014, 11:39 AM
  2. [SOLVED] Open File, Load Picture and on reopen (Initialize) the picture loads.
    By jquintana83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2014, 12:05 PM
  3. Click on picture and run macro to replace existing picture with selected picture file
    By houseflipsheet in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2014, 12:02 AM
  4. Replies: 2
    Last Post: 10-29-2013, 01:15 PM
  5. Creating macro to insert a picture by including specific picture name & path
    By NissaFrenchRamsteyn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2012, 05:40 AM
  6. [SOLVED] macro: insert picture based on workbook location, not picture root path.
    By NicksDad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2012, 07:47 AM
  7. Use VBA to crop a picture and save the picture in a folder
    By Cookstein2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2009, 12:01 PM

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