+ Reply to Thread
Results 1 to 10 of 10

Using a macro to add code to a newly created workbook.

Hybrid View

  1. #1
    Registered User
    Join Date
    12-03-2010
    Location
    Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Using a macro to add code to a newly created workbook.

    I think it has been taken care of. However if it hasn't I am working on another solution as well if that works I will post it here also. Thanks for your help. Also if it helps I am doing all of this with files on a shared network drive.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Using a macro to add code to a newly created workbook.

    sub snb()
    activeworkbook.vbproject.vbcomponents(1).codemodule.AddFromText replace(replace("Option Explicit||Private Declare Function sndPlaySound32 Lib ~winmm.dll~ Alias ~sndPlaySoundA~ (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long||Private Sub Worksheet_Change(ByVal Target As Range)|Dim Cell As Range||If Not Intersect(Target, Range(~B:B~)) Is Nothing Then|For Each Cell In Intersect(Target, Range(~B:B~))|If Range(~D~ & Cell.Row) = ~NOPE~ Then|sndPlaySound32(~C:\windows\media\notify.wav~, 1)|Exit Sub|End If|Next Cell|End If||End Sub","~",chr(34)),"|",vbCrLf)
    End Sub
    Last edited by snb; 12-16-2010 at 05:11 PM.



+ Reply to Thread

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