how to run Macro Excel file from vbs script.

VBS script Example.

how to run Macro Excel file from vbs script.

Step1- Open Notepad
>>paste below code>>File Save filename.vbs and run vbs file.

----------------------------------------------------------------------------

Set ObjExcel=CreateObject("Excel.Application")
objExcel.Application.Run"'C:\NitinVbaAppST\nitintest.xlsm'!Module1.msgtest"
ObjExcel.DisplayAlerts=False
ObjExcel.Application.Quit
Set ObjExcel=Nothing
---------------------------------------------------------------------------------


please note

msgtest is macro function name which use in nitintest.xlsm fil

Excel sound play code:


Excel sound play code:-


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
    Dim PlaySound As Boolean

    If Target.Column = 3 Then
        For Each Cell In Target
            'If WorksheetFunction.IsNA(Cell.Value) Then
            If Cell.Value = "line" Then
                PlaySound = True
            End If
        Next

        If PlaySound Then
            Call sndPlaySound32("C:\windows\media\Line.wav", 1)
        End If



    End If
End Sub

About Me

author Click here for Connect FB

Click here for Linkedin

Related Post No.

Powered by Blogger.

Contact Form

Name

Email *

Message *

Search This Blog

Recent Posts

Breaking

Recent Posts

Trending Topic

Breaking

Related Post No.

Pages