Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
error while compiling "OBJECT REQUIRED"
hi,
iam trying to run a macro in the excel but its throwing error "object required". kindly help me out . THE ERROR IS SHOWN FOR THE LAST LINE OF CODE. ------------------------------------------------------------------------------------------------------- Dim objWSH As String, objFileSystem, objlogfile As String Dim strWorkPath, lCountErrors, lCountWarnings, strLogFileName, strLogDate As String Dim strDHCPServer, strIPAddr, strMACAddr, strScope, strClientName, strComment, strtype As String Dim strOption, strOptionCode, strOptionValue, strDNSvalues As String Dim fso, DHCPInputFile, strLine, varLine, posFirstParam, strFirstParam As String Dim strNewLine, posSecondParam, strSecondParam, strThirdParam As String Dim strInputboxText, intInput, strInputFile, strRegion, strMsgboxText, intMsgbox As String Set objWSH = WScript.CreateObject("Wscript.shell") Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject") strWorkPath = objFileSystem.GetParentFolderName(WScript.ScriptFu llName) 'Set working directory 'Logfile configuration strLogDate = GetLogDate strLogFileName = objWSH.ExpandEnvironmentStrings(strWorkPath & "\" & strLogDate & ".log") Set objlogfile = objFileSystem.CreateTextFile(strLogFileName, True) ------------------------------------------------------------------------------------------------------- |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
error while compiling "OBJECT REQUIRED"
You declared:
objlogfile As String how about: objlogfile As Object nuti wrote: hi, iam trying to run a macro in the excel but its throwing error "object required". kindly help me out . THE ERROR IS SHOWN FOR THE LAST LINE OF CODE. ------------------------------------------------------------------------------------------------------- Dim objWSH As String, objFileSystem, objlogfile As String Dim strWorkPath, lCountErrors, lCountWarnings, strLogFileName, strLogDate As String Dim strDHCPServer, strIPAddr, strMACAddr, strScope, strClientName, strComment, strtype As String Dim strOption, strOptionCode, strOptionValue, strDNSvalues As String Dim fso, DHCPInputFile, strLine, varLine, posFirstParam, strFirstParam As String Dim strNewLine, posSecondParam, strSecondParam, strThirdParam As String Dim strInputboxText, intInput, strInputFile, strRegion, strMsgboxText, intMsgbox As String Set objWSH = WScript.CreateObject("Wscript.shell") Set objFileSystem = WScript.CreateObject("Scripting.FileSystemObject") strWorkPath = objFileSystem.GetParentFolderName(WScript.ScriptFu llName) 'Set working directory 'Logfile configuration strLogDate = GetLogDate strLogFileName = objWSH.ExpandEnvironmentStrings(strWorkPath & "\" & strLogDate & ".log") Set objlogfile = objFileSystem.CreateTextFile(strLogFileName, True) ------------------------------------------------------------------------------------------------------- -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|