Results 1 to 2 of 2

VBA Doesn't Work When I Share a workbook

Threaded View

  1. #1
    Registered User
    Join Date
    07-14-2011
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    28

    VBA Doesn't Work When I Share a workbook

    So my VBA code works fine when I have the file saved on my computer but when I go to post it on sharepoint and share the excel file the vba code stops working. The text box pops up when select a cell in column C or D but then the textbox just stays on the screen and displays only the message from column D not from column C (I have two different messages identified for each column). Is there a modification to make the code work? I used the following code:

    Public Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim strTitle As String
    Dim strMsg As String
    Dim sTemp As Shape
    Dim lDVType As Long
    Dim ws As Worksheet
    Application.EnableEvents = False
    Set ws = ActiveSheet
    Set sTemp = ws.Shapes("txtInputMsg")
    On Error Resume Next
    lDVType = 0
    lDVType = Target.Validation.Type
    On Error GoTo errHandler
    If lDVType = 0 Then
    sTemp.TextFrame.Characters.Text = ""
    sTemp.Visible = msoFalse
    Else
    If Target.Validation.InputTitle <> "" Or _
    Target.Validation.InputMessage <> "" Then
    strTitle = Target.Validation.InputTitle & Chr(10)
    strMsg = Target.Validation.InputMessage
    With sTemp
    '<<<<<<<<<<<< new code
    .Left = Target.Left + 65 'adjust to suit
    .Top = Target.Offset(3.1, 0).Top
    'end of new code >>>>>>>>>>>>
    With .TextFrame
    .Characters.Text = strTitle & strMsg
    .Characters.Font.Bold = False
    .Characters(1, Len(strTitle)).Font.Bold = True
    End With
    End With
    sTemp.Visible = msoTrue
    Else
    sTemp.TextFrame.Characters.Text = ""
    sTemp.Visible = msoFalse
    End If
    End If
    errHandler:
    Application.EnableEvents = True
    
    End Sub
    Last edited by Cutter; 08-22-2012 at 06:57 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

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