How can I have a pop up image in a cell, on a Mac

billyfern

New Member
Joined
Nov 17, 2017
Messages
2
Hi Guys,
I have seen this before, and i'm hoping that it's available on Excel 2016 for Mac, v15.40

The idea is to have an image in a cell,
and when the cursor is over the cell, the full image appears, then disappear when you move the cursor.

it's very similar to how Comments work within a cell,
hover the cursor over the cell, the Comment appears, and disappears when you move the cursor away from the cell,
I have seen this work on a YouTube video for a Mac, but there is no clue to the Excel version that was used.

When I tried, i had a different layout of tabs within the Format Cells command.


Hopefully you guys can help,
Thinks in advance
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Welcome to the forum!

Can it do comments? If so, a few tweaks should suffice.
Code:
'https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1195536-macro-to-find-pictures-and-insert-into-cell-comments
Sub Main()
  Dim p$, r As Range, c As Range, calc As Integer
  p = " c:\pictures\inventory\"
  'p = ThisWorkbook.Path & "\"
  
  On Error GoTo EndSub
  With Application
    .ScreenUpdating = False
    .EnableEvents = False
    calc = .Calculation
    .Calculation = xlCalculationManual
  End With
  
  Set r = Range("A2", Cells(Rows.Count, "A").End(xlUp))
  'Set r = [a2]
  For Each c In r
    PicToComment c.Offset(, 2), p & c.Value & ".jpg", c.Value, , 3 * 72
  Next c
  
EndSub:
  With Application
    .ScreenUpdating = True
    .EnableEvents = True
    .Calculation = calc
    .CutCopyMode = False
  End With
End Sub


Sub PicToComment(aCell As Range, picPath As String, _
  Optional cText As String = "", Optional dWidth As Double = 0, _
  Optional dHeight As Double = 0)
  Dim Cmnt As Comment, pic As StdPicture

  If Dir(picPath) = "" Then cText = "Not Found"
         
  Set Cmnt = aCell.Comment
  If Cmnt Is Nothing Then
    Set Cmnt = aCell.AddComment
    Cmnt.Shape.TextFrame.Characters.Text = cText
  End If
  If cText = "Not Found" Then Exit Sub
         
  Set pic = LoadPicture(picPath)
  With Cmnt.Shape
    'If dHeight = 0 Then dHeight = 100 * pic.Height / pic.Width
    If dHeight = 0 Then dHeight = pic.Height / 25.4
    .Height = dHeight
    
    'If dWidth = 0 Then dWidth = 100 * pic.Width / pic.Height
    'If dWidth = 0 Then dWidth = pic.Width / 25.
    If dWidth = 0 Then dWidth = dHeight * pic.Width / pic.Height
    .Width = dWidth
    
    .Fill.UserPicture picPath
  End With
End Sub
 
Upvote 0
Welcome to the forum!

Can it do comments? If so, a few tweaks should suffice.
Code:
'https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1195536-macro-to-find-pictures-and-insert-into-cell-comments
Sub Main()
  Dim p$, r As Range, c As Range, calc As Integer
  p = " c:\pictures\inventory\"
  'p = ThisWorkbook.Path & "\"
  
  On Error GoTo EndSub
  With Application
    .ScreenUpdating = False
    .EnableEvents = False
    calc = .Calculation
    .Calculation = xlCalculationManual
  End With
  
  Set r = Range("A2", Cells(Rows.Count, "A").End(xlUp))
  'Set r = [a2]
  For Each c In r
    PicToComment c.Offset(, 2), p & c.Value & ".jpg", c.Value, , 3 * 72
  Next c
  
EndSub:
  With Application
    .ScreenUpdating = True
    .EnableEvents = True
    .Calculation = calc
    .CutCopyMode = False
  End With
End Sub


Sub PicToComment(aCell As Range, picPath As String, _
  Optional cText As String = "", Optional dWidth As Double = 0, _
  Optional dHeight As Double = 0)
  Dim Cmnt As Comment, pic As StdPicture

  If Dir(picPath) = "" Then cText = "Not Found"
         
  Set Cmnt = aCell.Comment
  If Cmnt Is Nothing Then
    Set Cmnt = aCell.AddComment
    Cmnt.Shape.TextFrame.Characters.Text = cText
  End If
  If cText = "Not Found" Then Exit Sub
         
  Set pic = LoadPicture(picPath)
  With Cmnt.Shape
    'If dHeight = 0 Then dHeight = 100 * pic.Height / pic.Width
    If dHeight = 0 Then dHeight = pic.Height / 25.4
    .Height = dHeight
    
    'If dWidth = 0 Then dWidth = 100 * pic.Width / pic.Height
    'If dWidth = 0 Then dWidth = pic.Width / 25.
    If dWidth = 0 Then dWidth = dHeight * pic.Width / pic.Height
    .Width = dWidth
    
    .Fill.UserPicture picPath
  End With
End Sub


Thank You very much for this very fast response to my dilemma,

I can right click on a Cell, and Insert a Comment,
I can then Right Click and edit the same Comment,
I can Copy and Paste Text into a Comment Box,
I can't copy and paste an image into a Comment Box.

I'm a bit of a noob,
is this code a copy & Paste into a Terminal Window,
and, if it fails, is there a way to revert to the pre-Terminal hack state of play ?
I'm not great with Coding !



What exactly does this hack do
 
Upvote 0

Forum statistics

Threads
1,215,572
Messages
6,125,605
Members
449,238
Latest member
wcbyers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top