![]() |
Making a Msgbox popup
This code is also from Chip Pearsons website.
The below code sees if a procedure or function is there. How do I make it to where an input box comes up and then I type the name of the procedure or sub in and it tell me the output in a msgbox? Thanx Function ModuleExists(ModuleName As String) As Boolean On Error Resume Next ModuleExists = Len( _ ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0 End Function Function ProcedureExists(ProcedureName As String, _ ModuleName As String) As Boolean On Error Resume Next If ModuleExists(ModuleName) = True Then ProcedureExists = ThisWorkbook.VBProject.VBComponents (ModuleName) _ .CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0 End If End Function |
Making a Msgbox popup
Sub testit()
Dim strModuleName As String, strProcedureName As String strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?") If strProcedureName < "" Then MsgBox IIf(ProcedureExists(strProcedureName, strModuleName), "Exists", "Not Exists") End If End If End Sub "Todd Huttenstine" wrote in message ... This code is also from Chip Pearsons website. The below code sees if a procedure or function is there. How do I make it to where an input box comes up and then I type the name of the procedure or sub in and it tell me the output in a msgbox? Thanx Function ModuleExists(ModuleName As String) As Boolean On Error Resume Next ModuleExists = Len( _ ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0 End Function Function ProcedureExists(ProcedureName As String, _ ModuleName As String) As Boolean On Error Resume Next If ModuleExists(ModuleName) = True Then ProcedureExists = ThisWorkbook.VBProject.VBComponents (ModuleName) _ .CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0 End If End Function |
Making a Msgbox popup
Ah thank you. It works!
Todd -----Original Message----- Sub testit() Dim strModuleName As String, strProcedureName As String strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?") If strProcedureName < "" Then MsgBox IIf(ProcedureExists(strProcedureName, strModuleName), "Exists", "Not Exists") End If End If End Sub "Todd Huttenstine" wrote in message ... This code is also from Chip Pearsons website. The below code sees if a procedure or function is there. How do I make it to where an input box comes up and then I type the name of the procedure or sub in and it tell me the output in a msgbox? Thanx Function ModuleExists(ModuleName As String) As Boolean On Error Resume Next ModuleExists = Len( _ ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0 End Function Function ProcedureExists(ProcedureName As String, _ ModuleName As String) As Boolean On Error Resume Next If ModuleExists(ModuleName) = True Then ProcedureExists = ThisWorkbook.VBProject.VBComponents (ModuleName) _ .CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0 End If End Function . |
Making a Msgbox popup
Is there anyway to break them up where I can input a
module and see if it exists or a procedure instead of both popup boxes coming up at the same time -----Original Message----- Sub testit() Dim strModuleName As String, strProcedureName As String strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?") If strProcedureName < "" Then MsgBox IIf(ProcedureExists(strProcedureName, strModuleName), "Exists", "Not Exists") End If End If End Sub "Todd Huttenstine" wrote in message ... This code is also from Chip Pearsons website. The below code sees if a procedure or function is there. How do I make it to where an input box comes up and then I type the name of the procedure or sub in and it tell me the output in a msgbox? Thanx Function ModuleExists(ModuleName As String) As Boolean On Error Resume Next ModuleExists = Len( _ ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0 End Function Function ProcedureExists(ProcedureName As String, _ ModuleName As String) As Boolean On Error Resume Next If ModuleExists(ModuleName) = True Then ProcedureExists = ThisWorkbook.VBProject.VBComponents (ModuleName) _ .CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0 End If End Function . |
Making a Msgbox popup
Todd,
Sub testit() Dim strModuleName As String, strProcedureName As String Dim blnExists As Boolean strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?" & vbNewLine & "Leave blank or cancel to check for module only") If strProcedureName = "" Then blnExists = ModuleExists(strModuleName) Else blnExists = ProcedureExists(strProcedureName, strModuleName) End If MsgBox IIf(blnExists, "Exists", "Not Exists") End If End Sub Rob "Todd Huttenstine" wrote in message ... Is there anyway to break them up where I can input a module and see if it exists or a procedure instead of both popup boxes coming up at the same time -----Original Message----- Sub testit() Dim strModuleName As String, strProcedureName As String strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?") If strProcedureName < "" Then MsgBox IIf(ProcedureExists(strProcedureName, strModuleName), "Exists", "Not Exists") End If End If End Sub "Todd Huttenstine" wrote in message ... This code is also from Chip Pearsons website. The below code sees if a procedure or function is there. How do I make it to where an input box comes up and then I type the name of the procedure or sub in and it tell me the output in a msgbox? Thanx Function ModuleExists(ModuleName As String) As Boolean On Error Resume Next ModuleExists = Len( _ ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0 End Function Function ProcedureExists(ProcedureName As String, _ ModuleName As String) As Boolean On Error Resume Next If ModuleExists(ModuleName) = True Then ProcedureExists = ThisWorkbook.VBProject.VBComponents (ModuleName) _ .CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0 End If End Function . |
Making a Msgbox popup
Thank you, thats what I wanted.
Todd -----Original Message----- Todd, Sub testit() Dim strModuleName As String, strProcedureName As String Dim blnExists As Boolean strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?" & vbNewLine & "Leave blank or cancel to check for module only") If strProcedureName = "" Then blnExists = ModuleExists(strModuleName) Else blnExists = ProcedureExists(strProcedureName, strModuleName) End If MsgBox IIf(blnExists, "Exists", "Not Exists") End If End Sub Rob "Todd Huttenstine" wrote in message ... Is there anyway to break them up where I can input a module and see if it exists or a procedure instead of both popup boxes coming up at the same time -----Original Message----- Sub testit() Dim strModuleName As String, strProcedureName As String strModuleName = InputBox("Module?") If strModuleName < "" Then strProcedureName = InputBox("Procedure?") If strProcedureName < "" Then MsgBox IIf(ProcedureExists (strProcedureName, strModuleName), "Exists", "Not Exists") End If End If End Sub "Todd Huttenstine" wrote in message ... This code is also from Chip Pearsons website. The below code sees if a procedure or function is there. How do I make it to where an input box comes up and then I type the name of the procedure or sub in and it tell me the output in a msgbox? Thanx Function ModuleExists(ModuleName As String) As Boolean On Error Resume Next ModuleExists = Len( _ ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0 End Function Function ProcedureExists(ProcedureName As String, _ ModuleName As String) As Boolean On Error Resume Next If ModuleExists(ModuleName) = True Then ProcedureExists = ThisWorkbook.VBProject.VBComponents (ModuleName) _ .CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0 End If End Function . . |
All times are GMT +1. The time now is 10:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com