C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,239 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
C Sharp code below is to return either 0 or 1, and how to make use of such exe file on one VBA command to call this exe file?
namespace Validate_File1
{
class Program
{
static int Main(string[] args)
{
string s0;
s0 = args[0];if (s0.Trim() == "") { Console.WriteLine("No argument is input.");return 0; } if (File.Exists(s0)) { return 1; } else return 0; }
}
}
Hi,
try this:
Imports System.IO
Module Module1
Function Main(args As String()) As Integer
If args Is Nothing OrElse (args.Count > 0 AndAlso String.IsNullOrEmpty(args(0).Trim)) Then
Console.WriteLine("No argument is input.")
Return 0
End If
Dim s0 As String = args(0)
If File.Exists(s0) Then
Return 1
Else
Return 0
End If
End Function
End Module
Hi,
Thanks. How about the way to call such .exe file, via one VBA command?