+ Reply to Thread
Results 1 to 4 of 4

VBA module not working in 2013 Excel nor MAC 2011

  1. #1
    Registered User
    Join Date
    03-03-2015
    Location
    Cleveland, OH USA
    MS-Off Ver
    2013
    Posts
    4

    VBA module not working in 2013 Excel nor MAC 2011

    Hello everyone,

    I'm new to the site and I'm hoping someone can be of assistance. I'm using Excel 2010 but others in the company is running on Mac, using Excel 2011 for Mac or MS Office Excel 2013. The following code works for me with no issue (I'll attach the spreadsheet as well):

    Option Explicit


    Public Sub Add_Pic()

    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 a File Please!!!"
    Exit Sub
    End If

    'Offset the top left corner of the image to be in the
    'center of the selected cell
    lTop = Selection.Top + (Selection.Height / 2)
    lLeft = Selection.Left + (Selection.Width / 2)

    '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, 80, 80)
    oShape.ScaleHeight 1, msoTrue
    oShape.ScaleWidth 1, msoTrue

    'Name the shape "Picture" with the cell address appended
    oShape.Name = "Picture" & Selection.Address

    End Sub

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    Dim oShape As Shape
    Dim sName As String

    'Toggle picture visibility when the cell in which
    'the picture was originally inserted is selected

    sName = "Picture" & Target.Address

    For Each oShape In Sh.Shapes
    If oShape.Name = sName Then
    If oShape.Visible = msoTrue Then
    oShape.Visible = msoFalse
    Else
    oShape.Visible = msoTrue
    End If
    End If
    Next
    End Sub

    None of my PM's or Sales team is able to utilize the sheet but others using 2010 can. If anyone can advise what I need to fix those using MS Office 2013 Excel (majority) & why our MAC users (very small group), it would be greatly apprecated
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-03-2015
    Location
    Cleveland, OH USA
    MS-Off Ver
    2013
    Posts
    4

    Post Re: VBA module not working in 2013 Excel nor MAC 2011

    Resolved the issue with 2013, somehow I 'accidently' deleted my comment field, which is what my code was looking for in order to place the pic :0)

    But, I'm still having issues getting the MAC's 2011 Excel version to work.

    Any assistance would be greatly appreciated.

  3. #3
    Registered User
    Join Date
    03-03-2015
    Location
    Cleveland, OH USA
    MS-Off Ver
    2013
    Posts
    4

    Post Re: VBA module not working in 2013 Excel nor MAC 2011

    Recanting my previous statement, the Excel sheet only works in 2010 and not with 2013, still need assistance.

  4. #4
    Registered User
    Join Date
    03-03-2015
    Location
    Cleveland, OH USA
    MS-Off Ver
    2013
    Posts
    4

    Re: VBA module not working in 2013 Excel nor MAC 2011

    I'm racking my brains out..... feels like Monday. The 2013 is working fine now, for some reason, 2013 didn't like me protecting the sheet so I ran the code to unprotect the sheet when the button was clicked and to re-protect on save. BUT, I still have no idea why the module is not working in MAC 2011 Excel version. Any help would be much appreciated.

+ 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. Workaround needed - inconsistent functionality between Excel 2011 & 2013
    By a7x88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2014, 04:33 AM
  2. [SOLVED] VBA Project Password not working in Excel 2011 Mac OS 10.7.5
    By NU2vba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2013, 04:18 AM
  3. Text to Columns not working in Excel 2011
    By gcw in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 05-07-2013, 11:23 PM
  4. CSV Macro - not working in Mac Excel 2011
    By Nobranalon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2013, 11:40 PM
  5. Count Formula not working Excel Mac 2011
    By jimmerdean in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-20-2012, 04:34 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