Results 1 to 3 of 3

Add_Pic Marco: Pictures zoom-in at random after re-opening?!

Threaded View

  1. #1
    Registered User
    Join Date
    03-31-2015
    Location
    Rotterdam, Netherlands
    MS-Off Ver
    2010
    Posts
    5

    Add_Pic Marco: Pictures zoom-in at random after re-opening?!

    Dear all,

    I am new at Marcos. I have to insert a lot of pictures into various Excel worksheet. The Macro is created by someone else.
    Every time I open the file, some pictures are zoomed-in or completely blurred at random. The one time it concerns picture X, the other time it is picture Y.
    Most of the times I use the "Insert Picture Here" button, which was especially created to avoid formatting errors. However, there were some occasions where I used "Insert > Image" from the Excel Menu.

    Here is the Add_Pic Macro code:

    Sub Auto_Open()
        Sheets("MENU").Activate
    End Sub
    
    Sub Add_Pic()
     
    If Not Intersect(ActiveCell, Range("FotoRange")) Is Nothing Then
     
    Dim oActive As Worksheet
    Dim oShape As Shape
    Dim vSelection As Variant
    Dim lTop As Long
    Dim lLeft As Long
        
    Set oActive = ThisWorkbook.ActiveSheet
        
    'Allow the user to browse for an image file
    vSelection = Application.GetOpenFilename("Graphics files (*.gif;*.jpg), *.gif;*.jpg")
    If vSelection = False Then
        MsgBox "Select an image"
        Exit Sub
    End If
       
    lTop = Selection.Top
    lLeft = Selection.Left
     
    'Insert the image at the fixed size 80 X 80 and then reset size to 100%
    Set oShape = oActive.Shapes.AddPicture(vSelection, True, True, lLeft, lTop, Range("FotoBreedte"), Range("FotoHoogte"))
    oShape.ScaleHeight 1, msoTrue
    oShape.ScaleWidth 1, msoTrue
    oShape.SoftEdge.Type = msoSoftEdgeType1
     
    'Name the shape "Picture" with the cell address appended
    oShape.Name = "Picture" & Selection.Address
    
    Else
    MsgBox "You can only insert a picutre in the designated cells. Place your cursos on a cell and add the button "Insert Picture Here."
    End If
    End Sub
    [/COLOR][/COLOR][/COLOR]

    The Excel file is basically a template for setting up Work Instructions for our production facility. Therefore, the pictures have an important function as they visualize the various steps in the Work Instructions. The problem thus needs to be fixed otherwise the files are of no use due to reliability issues. Here is a screenshot of a part of the worksheet. The second image is zoomed in, only a detail is visible.
    Worksheet.jpg

    Could there be something wrong with the Macro code?

    Thanks a lot for your help.
    Kind regards,

    Eline de Vrij
    Last edited by Fotis1991; 01-18-2016 at 06:31 AM. Reason: Pls use code tags around your codes!! Thank you!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to bypass passwords on each worksheet and zoom to 40% on opening
    By kidwispa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2013, 06:25 AM
  2. hyperlink pictures opening in ie7
    By tryer in forum Excel General
    Replies: 15
    Last Post: 04-28-2010, 12:08 PM
  3. Pictures resize and move at random?
    By Dazman22 in forum Excel General
    Replies: 2
    Last Post: 11-17-2009, 09:18 AM
  4. Random Numbers that don't change on opening
    By panthergpss in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-16-2008, 08:57 PM
  5. Opening seperate sheet in wb in new window in predefined zoom
    By camcrazy08 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2007, 09:57 AM
  6. View zoom slowing opening of the file
    By ConnieM in forum Excel General
    Replies: 0
    Last Post: 07-27-2006, 06:10 PM
  7. [SOLVED] Stop marco allert and update link allert when opening spreadsheet
    By john conwell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2006, 07:20 PM
  8. [SOLVED] zoom error when opening file
    By colin919 in forum Excel General
    Replies: 0
    Last Post: 03-01-2005, 01: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