Results 1 to 6 of 6

Getting Formula of a lInked Picture

Threaded View

ptmuldoon Getting Formula of a lInked... 09-15-2020, 12:02 PM
ptmuldoon Re: Getting Formula of a... 09-15-2020, 03:00 PM
romperstomper Re: Getting Formula of a... 09-15-2020, 03:13 PM
ptmuldoon Re: Getting Formula of a... 09-16-2020, 11:38 AM
HSV Re: Getting Formula of a... 09-16-2020, 01:15 PM
ptmuldoon Re: Getting Formula of a... 09-16-2020, 03:16 PM
  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    863

    Getting Formula of a lInked Picture

    I have a script that loops through the worksheets, looks for a Cube Value formula and then converts those to their values. That script works pretty well.

    But I've found that if I create linked picture to others cells, the script is essentially bombing out/excel crashing. In searching out, I think a solution is to find your linked pictures and store those formulas into a variable and then re-insert them at the end. But I can't seem to quite figure it out.

    So i'm trying to the find/loop the pictures in a worksheet, and get their formula. This is what I've got so far and it will return the original formula, but I can't seem to figure out how to re-add it.

    Sub LoopThroughImages()
        Dim shp As Shape
        Dim F As String
        Dim ws As Worksheet
    
        Set ws = ActiveSheet
    
        For Each shp In ws.Shapes
            If shp.Type = msoPicture Then
                MsgBox shp.Name & " is a picture"
                'Get the linked formula
                F = shp.DrawingObject.Formula
                MsgBox F
                'Clear it
                shp.DrawingObject.Formula = ""
                'Readd it
                shp.DrawingObject.Formula = "=A1"  'This works
                shp.DrawingObject.Formula = "=" & F  'This does not work =$AB$12:$AF$19
                
            End If
        Next shp
    
    End Sub
    Edit. I found that if the formula is A1 to begin with, then it clear and readd A1. Thus, something with adding a range of cells as the formula?

    Sample file attached if it helps.

    Thank you,
    PT
    Attached Files Attached Files
    Last edited by ptmuldoon; 09-15-2020 at 01:20 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Having email body being a linked picture
    By abqm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2019, 05:23 AM
  2. Paste Linked Picture slowwwwwwww
    By Hambone70 in forum Excel General
    Replies: 2
    Last Post: 06-09-2017, 12:14 AM
  3. Can not update linked Picture
    By Mase123y in forum Excel General
    Replies: 6
    Last Post: 05-10-2017, 06:41 AM
  4. Replies: 5
    Last Post: 08-20-2014, 02:11 PM
  5. Insert Linked Picture as Comment
    By psmall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-18-2013, 04:12 AM
  6. Linked Picture?
    By DCSwearingen in forum Excel General
    Replies: 6
    Last Post: 08-03-2006, 09:10 PM
  7. [SOLVED] Refreshing Linked Picture
    By Rich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-05-2005, 09:06 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