Vbs 424 error

Please I need help!In my office they installed Office 2007, since then I am having several problems with my macros / VB script routines, in this occasion I am trying to use the FileSystemObject.CopyFile function to copy several files from one directory to several directories depending on the files code.Based on the file's code I build the destination path and then I try to copy my files from the original path to destination path, but when executing this sentence I receive an error message that says “Run-time error '424'  Object not fund”.

Please I need help!

In my office they installed Office 2007, since then I am having several problems with my macros / VB script routines, in this occasion I am trying to use the FileSystemObject.CopyFile function to copy several files from one directory to several directories depending on the files code.

Based on the file’s code I build the destination path and then I try to copy my files from the original path to destination path, but when executing this sentence I receive an error message that says “Run-time error ‘424’  Object not fund”.

Please if anyone can give me any advise, the following is the code I am usisng, you will see is a very easy code.

Sub prepara_2007()

            Sheets(«IngresoBD»).Select

            Range(«I5»).Select

            For Each archivo In Range(«i5:i1000»)

            If archivo.value = «» Then

                        Exit For

            Else

                        raiz = «D:Procesos de Negocio2.-FacilidadesEC-GNR1 Control Documental»

                         ‘ Calcula la locacion y el activo correspondiente

                         ‘ Obtiene la locacion del codigo

                        fila = archivo.Row

                        cuenta = Len(Range((«D» + Trim(Str(fila)))).value) + 2

                        letra = «»

                        locacion = «»

                        Do While letra <> «-«

                                    letra = Mid(archivo.value, cuenta, 1)

                        If letra <> «-» Then

                                                locacion = locacion + letra

                                    cuenta = cuenta + 1

                                   End If

                        Loop

             ‘ Si la codificacion de la locacion es la antigua busca el nuevo codigo y simultaneamente obtiene el activo

                        If UCase(Range((«J» + Trim(Str(fila)))).value) = «O» Then

                                    Sheets(«Sheet1»).Select

                        For Each ubica In Range(«a1:a500»)

                                                If Trim(ubica.value) = locacion Then

                                                fila2 = ubica.Row

                                                           newloc = Range((«B» + Trim(Str(fila2)))).value

                                    activo = Range((«C» + Trim(Str(fila2)))).value

                                                Exit For

                                               End If

                        Next

            Else

                                    Sheets(«Sheet1»).Select

                        For Each ubica In Range(«B1:B500»)

                                                If Trim(ubica.value) = locacion Then

                                                            fila2 = ubica.Row

newloc = locacion

                                                           activo = Range((«C» + Trim(Str(fila2)))).value

                                                           Exit For

                                               End If

                                    Next

                        End If

                        Sheets(«IngresoBD»).Select

                        proceso = «02 Ingenieria y Construccion»

                        tpdoc = «01 Documentacion Tecnica»

                        discip = «»

                        inicia = cuenta + 1

                        discip = Mid(archivo.value, inicia, 1)

                        Select Case disciplina

                                    Case 1

                                                disciplina = «01 Procesos-10-I1»

                                    Case 2

                                                disciplina = «02 Mecanico-20-I1»

                                    Case 3

                                                disciplina = «03 Civil-30-I1»

                                    Case 5

                                                disciplina = «04 Tuberia-50-I1»

                                    Case 6

                                                disciplina = «05 Instrumentacion-60-I1»

                                    Case 7

                                                disciplina = «06 Electrico-70-I1»

                        End Select

                        destino = raiz + activo + «» + proceso + «» + newloc + «» + tpdoc + «» + disciplina

                        origen = «D:Procesos de Negocio2.-Facilidadestemp» + archivo.value

                        FileSystemObject.CopyFile origen, direccion

                        direccion = destino + archivo.value

                        Range((«K» + Trim(Str(fila)))).value = direccion

            End If

Next
End Sub

Hi,

I am writing a vbs logon script to map to a network drive upon login. However, I am encountering a intermittent issue. Most of the times, I am able to map to the drive successfuly. Occasionally, the script fails with a Error 424 Object required. I also
tried triggereing the script numerous times on my desptop. It seems fine. Below is the snippet of my script. Any help is deeply appreciated. Thanks.

Option Explicit
Dim objNetwork,objFSO,objSysInfo,strUserDN,objUser,strLocation,wshShell,cnt,sHost,oIP,sIP
Dim strDriveLetter,strRemotePath,pingDurMin,svcDwn
strDriveLetter = «X:»
cnt=0
pingDurMin=10

Set objNetwork = CreateObject(«WScript.Network»)
Set objFSO = CreateObject(«Scripting.FileSystemObject»)
Set wshShell = CreateObject(«WScript.Shell»)
Set objSysInfo = CreateObject(«ADSystemInfo»)

sHost=objNetwork.ComputerName
For Each oIP in GetObject(«winmgmts:»).execQuery(«select * from win32_pingstatus where address = ‘» & sHost & «‘ «)
sIP=oIP.ProtocolAddress
Next

wshShell.LogEvent 0,»[» & sHost & «,» & sIP & «,» & objNetwork.UserName & «] Mapping script has been started»

If pingPass() Then
On Error Resume Next
 
strUserDN = objSysInfo.UserName
Set objUser = GetObject(«LDAP://» & strUserDN)
strLocation = objUser.Parent

 If (objFSO.DriveExists(strDriveLetter) = False) Then
 If InStr(strLocation, «OU=A1,OU=B,OU=C,OU=D») Then
  mapDrive
 ElseIf InStr(strLocation, «OU=A2,OU=B,OU=C,OU=D») Then
      mapDrive    
  End If
 Else
 ‘Do Nothing
 End If

 errCheck Err.Number, Err.Description

Else
wshShell.LogEvent 1,»[» & sHost & «,» & sIP & «,» & objNetwork.UserName & «] Script has been terminated.

End If

WScript.Quit
 

Function pingPass
        Dim strGateway, objPing
 pingPass=False
 strGateway = «1.2.3.4»

 svcDwn=DateAdd(«n»,pingDurMin,Now())
        Do
         Set objPing = GetObject(«winmgmts:»).InstancesOf(«Win32_PingStatus» & » WHERE Address='» & strGateway & «‘ AND statusCode=0»)
  If objPing.Count = 1 Then
   pingPass=True
   Exit Function 
  End If
  cnt = cnt + 1
  If cnt = 10 Then
  WScript.Sleep 60000
  cnt = 0
  End If
        Loop until Now > svcDwn
 
End Function

  • Moved by

    Monday, March 19, 2012 7:04 AM
    Script issue (From:Visual Basic General)

Approved

  • 1. Download ASR Pro
  • 2. Open the program and select «Scan your computer»
  • 3. Click «Repair» to start the repair process
  • The software to fix your PC is just a click away — download it now.

    You may encounter an error message that says vbscript runtime error object 424 is required. Now there are a number of steps you can take to resolve this issue which we will discuss in a moment. The name of the object used in the script usually does not match the name of the object in the image. Rename the object in the image to match the protest name in the VBA script. An object name mismatch between an important image and its script is the cause of the “runtime error 424”.

    In hard-to-find cases, this error occurs when someone owns an object, but is valid, trying to execute an invalid hint on the object. For example, you might get this error if your company is trying to assign a value that you can assign to a read-only property. You check the documentation of the most important object and make sure that the gameplay you want to run is really valid.

    Required object means that the object’s data method reference must be exact. If Encoding has the “Explicit word” checkbox checked and the checkbox unchecked, everyone will get an “Object required” error for misspelled variable words, and if the “Explicit” checkbox is checked, an “Undefined variable” error will occur for misspelled variable words.

    First in Explicit, the parameter means (quickly) that all your function variables must be explicitly declared in Dim statements. They can be any form, object, including an integer, or a string variant.

    This line Dim: envFrmwrkPath As Range various declares envFrmwrkPath of type Range. This may mean that you can only specify a range for it.

    This binding Set: envFrmwrkPath ActiveSheet =.Range("D6").Value attempts to set the Range type to a specific value that actually exists D6 code> cell. For example, it could be an integer or a string (depending on what the clients have in the cell), but they don't have a range.

    In your relatively simple visual editor, go to the Debug menu.Use stepping to walk through the entire code.By the time you get to the line where most people get the error, VBA will show the error.Please fix this line of code.

    I'll say I'd prefer the stored value. Try itlike this:

    Dim Say As myvariablename = integermyvariablename ActiveSheet.Range("D6").Value

    This assumes you are storing the number 5) (for example, in cell D6. Your variable should now have a value.

    For simplicity, Linked can learn to remove or comment out the VBA line Option Explicit and try to actually determine the type of the variable at runtime.

    vbscript runtime error object required 424

    Dim envFrmwrkPath as a stringDarken application name as a stringDim TestIterationName as string
  • 25 June 09:22 2009, afternoon#1 topics

    vbscript runtime error object required 424

    Participant Launchers

    New


    [SOLVED] Runtime Error "424": Object Is Waiting For VB6

    Good afternoon. I'm very bullshit worried about VB6 OK, I'm into vba but I can't figure it out yet. I had to get the encoding from a "different" site. http://www.kdkeys.net/forums/thread/868.aspx (I know, but I needed to start somewhere if I had to) - after a lot of fiddling, it almost worked. It hits our line: next -

    Code:

    labell1.Caption = .Fields("formid").Value & vbCrLf & .Fields("form name").Value & vbCrLf

    All I'm trying to do is figure out how to connect to the vb6 repository. Here is the detailed code I copied:-

    Code:

    Dim sConn String as ' la for connection string'Now that we declare an ADODB connectionTo be able to view this new ADODB connection, you need the following:'1 do. is in your toolbox, you need to add the component.2. In the component field you will find the activex-microsoft-ado connection which provides something like this.3. finish when drag the component to the current form and then delete it.4. So you can have a NEW ADODB line in your intellisense.'Now with connection continuation of each person and db vb6.0Dim db as ADODB new.connectionDim rs same new ADODB as .RecordsetDim As sPath String 'Here the experts set the path to your custom databaseDim sSQL String as 'Your SQL statement"Let's get down to business now.Private subcommand1_Click()sPath = "D:FormscapeDatabaseformscape.mdb"'Initialize it connection="Provider=Microsoft stringsConn.Jet.OLEDB.4.0;DataSource="SPathSSQL &=* In "Select Forms"db.ConnectionString = sConndb.openwith RS.ActiveConnection = db.LockType equals adLockOptimistic.CursorType = AdOpenCaseset.SQL .openNow .let's .go through .your .discs .and .show them to .your .label' .In .example .your .table .has .two .fields, .field .name .name .and .descriptionDo .without ..EOFlabel1.Caption = .Fields("formid").Value & vbCrLf & .Fields("formname").Value & vbCrLf.MoveNextribbon'leave connection rsrs.Closefinish withHire first playerDb =.CloseSet db = nothingEnd of subtitles

    du selected Any help would be appreciated. Thanks Des.

  • If VBA can actually recognize the object you're referencing, it's all forproperty or method, it will give you an "Object required" error.

    June 25, 2009 Name="2"> 09:56#2<а

    Find the erroneous programming line (if it is not highlighted, use debug mode)Determine if you were referring to undeclared objects.FindNot one of the most common functions that can cause errors, and define them as considered valid (with correct syntax).

    Welcome to VBForums

    The error is caused by the fact that your form does not currently have a label control named Label1, which should have been mentioned by the guy who posted it. Needless to say, this is not the only thing that usually causes problems.

    I would recommend using abort this code (and certainly not Suggestion to add some component because it contains at least seven things that are designed/coded with impatience, which leads to bugs or strange behavior (for position you see dates, like the last entry).Que

    what I actually recommend is to take a look at the "Classic VB: ADO" section linked to our database development FAQ/tutorials (at the top of the database development forum), "Tutorial especially on ADO" − and not the same Art along with derivations explaining different parts of the code to you.

  • Find the erroneous line of code (if it's never highlighted, use debug mode).Determine if you were referring to any objects that are not normally declared.Find functions that can cause an error and determine if they are called efficiently (with the correct syntax).

    June 25, 22:10 2009 afternoon Name="3">#3

    Thread Launcher

    New member src="/images/reputation/reputation_pos.runtime monitor: png


    Subject '424': Block Object>Need Vb6

  • June 26, morning#4 launch

    Thread Tool

    New member


    Subject: Runtime Error In Solution '424': VB6 Theme Required

    Okay, I did it well for you. Very good to find working codes (http://www.vbforums.com/showthread.php?t=551154) - just change something, match this data/path etc. Thanks a lot. From.
  • June 26, 2009 at 12:05 pm.#5 runtime

    Object: Error Required '424': VB6 Object

    Once we determine that you have been helped, you can help us by marking the topic as solved. If JavaScript is enabled, your family can easily do this by selecting the "Chat Tools" menu and "Mark item branch as branch". Even if someone was particularly helpful, you havethere is still an opportunity to influence his "reputation" on the forum by evaluating his message. Only the ratings you leave after 20 years of posting count, but really, either way, the person you rate will see your rating and remember that you appreciate their own help.

    Approved

    The ASR Pro repair tool is the solution for a Windows PC that's running slowly, has registry issues, or is infected with malware. This powerful and easy-to-use tool can quickly diagnose and fix your PC, increasing performance, optimizing memory, and improving security in the process. Don't suffer from a sluggish computer any longer - try ASR Pro today!

    The software to fix your PC is just a click away - download it now.

    Object Required in Excel VBA. Object Required is a runtime fatal error when we set a Varied that is not an object, even though we try to assign some with detection using the SET statement. Each method requires an object identifier, so it is assigned to objects using the SET statement.

    Launch Excel.Select "Add-ons" from the "Tools" menu.Click the Browse button.Browse the folder to C:Program Files (x86)Jetreports.Select the Jetreports.xla file.click OK. If you are prompted to click Replace, Yes.

  • aaaaaaFaaaaaaaa

    0 / 0 / 0

    Регистрация: 03.03.2015

    Сообщений: 6

    1

    03.03.2015, 11:29. Показов 2143. Ответов 10

    Метки нет (Все метки)


    Добрый день! просьба помочь.
    В Outlook создал Макрос, который должен запускать test.vbs.
    Но выдает ошибку.

    ——————Код——————

    Visual Basic
    1
    2
    3
    4
    5
    6
    
    Sub NewMacro()
       
       Dim procID As Integer
       procID = Shell("C:vbs_Outlooktest.vbs", AppWinStyle.NormalFocus)
       
    End Sub

    —————————————-

    Ошибка — Run-time error ‘424’: Object required

    —————————————-

    Что что здесь описано, тоже не помогает ( )

    Добавлено через 1 минуту
    ссылка, которая не вставилась

    http://support.microsoft.com/kb/163475

    __________________
    Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



    0



    Казанский

    15131 / 6405 / 1730

    Регистрация: 24.09.2011

    Сообщений: 9,999

    03.03.2015, 12:01

    2

    Цитата
    Сообщение от F1

    Shell Function

    Runs an

    executable program

    Поэтому нужна программа-посредник, которая запустит скрипт:

    Visual Basic
    1
    
    procID = Shell("cmd /c C:vbs_Outlooktest.vbs", AppWinStyle.NormalFocus)

    При этом procID будет относиться, видимо, к cmd.exe, а не к wscript.exe.



    1



    aaaaaaFaaaaaaaa

    0 / 0 / 0

    Регистрация: 03.03.2015

    Сообщений: 6

    03.03.2015, 12:20

     [ТС]

    3

    Visual Basic
    1
    
    procID = Shell("cmd /c C:vbs_Outlooktest.vbs", AppWinStyle.NormalFocus)

    На это все равно выдает ошибку (туже самую).

    Попробовал даже так:

    Visual Basic
    1
    
    procID = Shell("cmd", AppWinStyle.NormalFocus)

    Все равно такая же ошибка



    0



    Казанский

    15131 / 6405 / 1730

    Регистрация: 24.09.2011

    Сообщений: 9,999

    03.03.2015, 12:29

    4

    Ну тогда

    Visual Basic
    1
    
    CreateObject("WScript.Shell").Run "C:vbs_Outlooktest.vbs"



    1



    Catstail

    Модератор

    Эксперт функциональных языков программированияЭксперт Python

    33878 / 18905 / 3981

    Регистрация: 12.02.2012

    Сообщений: 31,700

    Записей в блоге: 13

    03.03.2015, 12:42

    5

    А мне не нравится вот это:

    Visual Basic
    1
    
    AppWinStyle.NormalFocus

    Пиши просто NormalFocus. А у тебя получается, что AppWinStyle — это объект (которого нет на самом деле). Отсюда и ошибка «Object Required»



    2



    15131 / 6405 / 1730

    Регистрация: 24.09.2011

    Сообщений: 9,999

    03.03.2015, 12:51

    6

    Точно! vbappwinstyle.vbNormalFocus



    0



    aaaaaaFaaaaaaaa

    0 / 0 / 0

    Регистрация: 03.03.2015

    Сообщений: 6

    03.03.2015, 14:45

     [ТС]

    7

    Visual Basic
    1
    
    CreateObject("WScript.Shell").Run "C:vbs_Outlooktest.vbs"

    Так попробовал, выдает ошибку:
    —————-Ошибка———————-
    Run-time error ‘-2147024894(80070002)’:
    Method ‘Run’ of object ‘IWshShell3’ failed
    ————————————————

    Попробовал так:

    Visual Basic
    1
    
    procID = Shell("cmd /c C:vbs_Outlooktest.vbs", NormalFocus)

    Видно что CMD запускает и закрывает, но test.vbs не запускает и выдает ошибку:
    —————-Ошибка———————-
    Run-time error ‘6’:
    Overflow
    ————————————————



    0



    Catstail

    Модератор

    Эксперт функциональных языков программированияЭксперт Python

    33878 / 18905 / 3981

    Регистрация: 12.02.2012

    Сообщений: 31,700

    Записей в блоге: 13

    03.03.2015, 14:59

    8

    Опиши procId вот так:

    Visual Basic
    1
    
    Dim procID As Long

    Добавлено через 8 минут
    Создал файл «test.vbs» из одной строки

    Visual Basic
    1
    
      MsgBox "Привет из VBScript!!!"

    В Excel (за неимением Outlook-a) пишу:

    Visual Basic
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    Sub main()
     
    Dim progID As Long
     
        HomeDir$ = ThisWorkbook.Path
     
        procID = Shell("cmd /c " & HomeDir$ & "test.vbs", NormalFocus)
     
    End Sub

    Все прекрасно работает…



    1



    0 / 0 / 0

    Регистрация: 03.03.2015

    Сообщений: 6

    03.03.2015, 15:05

     [ТС]

    9

    Спасибо все получилось

    Если не сложно, еще один момент, как сделать работу CMD не видимой для пользователя?
    И потом закрыть CMD.



    0



    Апострофф

    Заблокирован

    03.03.2015, 15:16

    10

    Visual Basic
    1
    
    procID = Shell("cmd /c /q " & HomeDir$ & "test.vbs", vbHide)

    ?



    2



    aaaaaaFaaaaaaaa

    0 / 0 / 0

    Регистрация: 03.03.2015

    Сообщений: 6

    03.03.2015, 15:17

     [ТС]

    11

    Это я уже сделал:

    Visual Basic
    1
    
    procID = Shell("cmd /c C:vbs_OutlookSekret.vbs", vbHide)

    Спасибо Всем кто помог



    0



    Permalink

    Cannot retrieve contributors at this time

    title keywords f1_keywords ms.prod ms.assetid ms.date ms.localizationpriority

    Object required (Error 424)

    vblr6.chm1000424

    vblr6.chm1000424

    office

    282292d7-d147-b71e-4d1e-149af7da8f7e

    06/08/2017

    medium

    References to properties and methods often require an explicit object qualifier. This error has the following causes and solutions:

    • You referred to an object property or method, but didn’t provide a valid object qualifier. Specify an object qualifier if you didn’t provide one. For example, although you can omit an object qualifier when referencing a form property from within the form’s own module, you must explicitly specify the qualifier when referencing the property from a standard module.

    • You supplied an object qualifier, but it isn’t recognized as an object. Check the spelling of the object qualifier and make sure the object is visible in the part of the program in which you are referencing it. In the case of Collection objects, check any occurrences of the Add method to be sure the syntax and spelling of all the elements are correct.

    • You supplied a valid object qualifier, but some other portion of the call contained an error. An incorrect path as an argument to a host application’s File Open command could cause the error. Check arguments.

    • You didn’t use the Set statement in assigning an object reference. If you assign the return value of a CreateObject call to a Variant variable, an error doesn’t necessarily occur if the Set statement is omitted. In the following code example, an implicit instance of Microsoft Excel is created, and its default property (the string «Microsoft Excel») is returned and assigned to the Variant RetVal. A subsequent attempt to use RetVal as an object reference causes this error:

        Dim RetVal ' Implicitly a Variant. 
        ' Default property is assigned to Type 8 Variant RetVal. 
        RetVal = CreateObject("Excel.Application") 
        RetVal.Visible = True ' Error occurs here. 

      Use the Set statement when assigning an object reference.

    • In rare cases, this error occurs when you have a valid object but are attempting to perform an invalid action on the object. For example, you may receive this error if you try to assign a value to a read-only property. Check the object’s documentation and make sure the action you are trying to perform is valid.

    For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

    [!includeSupport and feedback]

    1. May 23rd, 2004, 03:03 PM


      #1

      tiger756 is offline

      Thread Starter


      New Member


      Unhappy Error 424; object required

      When I use in my VBScript

      Code:

      CreateObject("Scripting.FileSystemObject").GetFile(WScript.ScriptFullName)

      I get an Error 424 ‘object required’. What is wrong?


    2. May 23rd, 2004, 04:02 PM


      #2

      When you create an object you need to assign its reference to a variable before you can invoke its methods. This slight modification should work:

      VB Code:

      1. Set fso = CreateObject("scripting.filesystemobject")

      2. Set file = fso.getFile(wscript.scriptfullname);


    3. May 24th, 2004, 05:07 AM


      #3

      tiger756 is offline

      Thread Starter


      New Member


      Error 424; object required

      I’ve done that but it still doesn’t work.

      It works in a .VBS but if I try compiling it with VB6 it doesn’t work as an .EXE!!


    4. May 24th, 2004, 07:37 AM


      #4

      You need to go to the Project->References menu and add a reference to a the Scripting Runtime Library.

      You can then create an instance of the file system obejct in your code in the normal way.

      VB Code:

      1. Set fso = New FileSystemObject

      The code you are using won’t work in Visual Basic because Visual Basic does not have the wscript object. I also do not think there is a way of instantating it using CreateObject.


    5. May 24th, 2004, 12:09 PM


      #5

      tiger756 is offline

      Thread Starter


      New Member


      It works!

      Thanks!

      It works now after adding a reference to the MS Scripting Runtime.

      But I’ve still a question:

      Do I need the SCRRUN.DLL when I want to start the Program on an other PC or is it included in my EXE file after compiling it??


    6. May 24th, 2004, 01:00 PM


      #6

      Re: It works!

      Originally posted by tiger756
      Do I need the SCRRUN.DLL when I want to start the Program on an other PC or is it included in my EXE file after compiling it??

      Yes you do. However this shouldn’t concern you unless you are making applications for pre windows 95 as the Microsoft Scripting runtime has been included with Windows as standard since then.


    Понравилась статья? Поделить с друзьями:
  • Vboxnetadpctl error while adding new interface failed to open dev vboxnetctl permission denied
  • Vboxmanage exe error failed to create the host only adapter
  • Vboxmanage exe error failed to compact medium
  • Vboxmanage exe error appliance import failed
  • Vboxmanage error vt x is not available verr vmx no vmx