+ Reply to Thread
Results 1 to 2 of 2

VBA to insert image to specific cell

  1. #1
    Registered User
    Join Date
    06-18-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    9

    VBA to insert image to specific cell

    please do guide me where I am mistaking in the code.
    Thanks in advance


    Dim oPic As Picture
    Dim sFilename As String

    'Prompt user for file
    sFilename = Application.GetOpenFilename( _
    filefilter:="Pictures (*.jpg), *.jpg", _
    Title:="Insert Picture", _
    ButtonText:="Insert")

    'If the user cancels, exit the sub
    If sFilename = "False" Then Exit Sub

    'Insert the picture in the active sheet
    Set oPic = ActiveSheet.Pictures.Insert(sFilename)

    'Set the properties
    With oPic
    .ShapeRange.LockAspectRatio = msoTrue
    .Left = Range("B2").Left
    .Top = Range("B2").Top
    .Width = 75 'or Range("B2:C2").Width
    End With

  2. #2
    Registered User
    Join Date
    06-18-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    9

    Re: VBA to insert image to specific cell

    it says COMPILE ERROR on

    " "Pictures (*.jpg), *.jpg" "

+ 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. [SOLVED] Insert the first image found with image search (e.g google) with criteria taken from cell.
    By themob212 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 04-14-2021, 12:29 PM
  2. Insert a specific image based on value/cell value
    By markusvirus in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2015, 12:18 PM
  3. [SOLVED] Insert an image at a specific location on a worksheet
    By ozhunter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2015, 08:35 AM
  4. Insert image and image name into specific place on sheet
    By ACE23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2014, 04:41 AM
  5. Macro to insert image on specific place
    By kooijman599 in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 05:56 PM
  6. Insert URL Image into Cell
    By Douglas Post in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2012, 11:52 AM
  7. [SOLVED] How do I insert an image into a specific cell within a protected .
    By Scott Peebles in forum Excel General
    Replies: 1
    Last Post: 01-06-2005, 10:06 PM

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