Consulting

Results 1 to 6 of 6

Thread: VBA code not working in 365

  1. #1

    VBA code not working in 365

    I have recently upgraded to Excel 365 from 2010 which I have used with no problem for many years.

    I have this code which still works perfectly fine in 2010, but I am getting a 400 error message when I try and run the spreadsheet in 365

    Is there an obvious reason why 365 does not like the code?

    HTML Code:
    Public Sub Add_Images_To_Cells()
    ActiveSheet.Pictures.DELETE
    
        Dim lastRow As Long
        Dim URLs As Range, URL As Range
        
        With ActiveSheet
            lastRow = .Cells(Rows.Count, "A").End(xlUp).Row
            Set URLs = .Range("A2")
        End With
    
        For Each URL In URLs
            URL.Offset(0, 4).Select
            URL.Parent.Pictures.Insert URL.Value
            DoEvents
        Next
         End Sub

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post an example workbook, it is hard to see anything without context.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    here is a very small element of the spreadsheet that shows the code working/not working
    Attached Files Attached Files

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    You might have to download the pictures first, and then Insert them locally from the HD
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    Quote Originally Posted by Paul_Hossler View Post
    You might have to download the pictures first, and then Insert them locally from the HD
    Ahh I was trying to avoid that, I might just go back to 2010 then, as it works OK there

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Some one else may have a better idea, but when I pasted the URL.Value into Edge, it just wanted to download the picture
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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