For loop not initialized error 92

I am supposed to revise a tool of a former colleague. This creates a Word document based on an Excel table (column 1 = heading, column 2 = text). The Excel table should be expandable in the long run.

I am supposed to revise a tool of a former colleague. This creates a Word document based on an Excel table (column 1 = heading, column 2 = text). The Excel table should be expandable in the long run. Which chapters are created can be selected by check boxes.
However, if the tool is used more than once, the run time error 92 occurs. Since I use a mask with data that is also inserted in the document, the tool should not have to be restarted. I am a complete beginner and would be very happy about a tip. After the For-loop is a block that formats the headings. Maybe this is also where the error lies.
Many thanks in advance!

I have seen a similar problem here, unfortunately it did not help me.
Can’t solve Run-time error 92: For loop not initialized. Any idea?

With wdApp.Selection
'Text body is created from Excel
Dim oChild As Node
 For Each X In tv_Texte.Nodes
    If X.Checked And X.Children Then
            .InsertBreak 7
            .Style = wddoc.Styles("Überschrift 1")
            .TypeText Text:=X.Text
            .TypeParagraph
            Set oChild = X.Child
            Do
               On Error GoTo Error:
                If oChild.Checked Then
                'Search entry in table
                i = 1
                Do Until IsEmpty(Workbooks(1).Sheets(X.Text).Range("A" & i + 3)) Or (Workbooks(1).Sheets(X.Text).Range("A" & i + 3) = oChild.Text)
                    i = i + 1
                    Loop
                .Style = wddoc.Styles("Überschrift 2")
                .TypeText Text:=oChild.Text
                .TypeParagraph
                .Style = wddoc.Styles("Standard")
                If IsEmpty(Workbooks(1).Sheets(X.Text).Range("B" & i + 3).Value) Then
                       MsgBox "Fehler beim Importieren der Überschrift: " & vbCrLf & X.Text & " -> " & oChild.Text & vbCrLf & "Kein Text hinterlegt!"
                Else
                'Insert chapter text
                wdApp.Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
                .TypeText Text:=Replace(Workbooks(1).Sheets(X.Text).Range("B" & i + 3).Value, "vbTab", vbTab)
                .TypeParagraph
                End If
                End If
                Set oChild = oChild.Next
Error:
            Loop Until oChild Is Nothing
   
    End If
Next X
'This block creates the headings:
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(1)
        .NumberFormat = "%1"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(0.76)
        .TabPosition = wdUndefined
        .ResetOnHigher = 0
        .StartAt = 1
        .LinkedStyle = "Überschrift 1"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(2)
        .NumberFormat = "%1.%2"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(1.02)
        .TabPosition = wdUndefined
        .ResetOnHigher = 1
        .StartAt = 1
        .LinkedStyle = "Überschrift 2"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(3)
        .NumberFormat = "%1.%2.%3"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(1.27)
        .TabPosition = wdUndefined
        .ResetOnHigher = 2
        .StartAt = 1
        .LinkedStyle = "Überschrift 3"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(4)
        .NumberFormat = "%1.%2.%3.%4"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(1.52)
        .TabPosition = wdUndefined
        .ResetOnHigher = 3
        .StartAt = 1
        .LinkedStyle = "Überschrift 4"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(5)
        .NumberFormat = "%1.%2.%3.%4.%5"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(1.78)
        .TabPosition = wdUndefined
        .ResetOnHigher = 4
        .StartAt = 1
        .LinkedStyle = "Überschrift 5"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(6)
        .NumberFormat = "%1.%2.%3.%4.%5.%6"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(2.03)
        .TabPosition = wdUndefined
        .ResetOnHigher = 5
        .StartAt = 1
        .LinkedStyle = "Überschrift 6"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(7)
        .NumberFormat = "%1.%2.%3.%4.%5.%6.%7"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(2.29)
        .TabPosition = wdUndefined
        .ResetOnHigher = 6
        .StartAt = 1
        .LinkedStyle = "Überschrift 7"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(8)
        .NumberFormat = "%1.%2.%3.%4.%5.%6.%7.%8"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(2.54)
        .TabPosition = wdUndefined
        .ResetOnHigher = 7
        .StartAt = 1
        .LinkedStyle = "Überschrift 8"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(9)
        .NumberFormat = "%1.%2.%3.%4.%5.%6.%7.%8.%9"
        .TrailingCharacter = wdTrailingTab
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = CentimetersToPoints(0)
        .Alignment = wdListLevelAlignLeft
        .TextPosition = CentimetersToPoints(2.79)
        .TabPosition = wdUndefined
        .ResetOnHigher = 8
        .StartAt = 1
        .LinkedStyle = "Überschrift 9"
End With
        ListGalleries(wdOutlineNumberGallery).ListTemplates(1).Name = ""
        .Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
        ListGalleries(wdOutlineNumberGallery).ListTemplates(1), _
        ContinuePreviousList:=False, ApplyTo:=wdListApplyToWholeList, _
        DefaultListBehavior:=wdWord10ListBehavior
        .Delete Unit:=wdCharacter, Count:=1         'Empty chapter is created and deleted
End With

Icon Ex Номер ошибки: Ошибка во время выполнения 92
Название ошибки: For loop not initialized
Описание ошибки: For loop counters must be initialized.
Разработчик: Microsoft Corporation
Программное обеспечение: Windows Operating System
Относится к: Windows XP, Vista, 7, 8, 10, 11

Определение «For loop not initialized»

Как правило, специалисты по ПК называют «For loop not initialized» как тип «ошибки времени выполнения». Программисты работают через различные уровни отладки, пытаясь убедиться, что Windows Operating System как можно ближе к безошибочным. Тем не менее, возможно, что иногда ошибки, такие как ошибка 92, не устранены, даже на этом этапе.

Ошибка 92 также отображается как «For loop counters must be initialized.». Это распространенная ошибка, которая может возникнуть после установки программного обеспечения. Таким образом, конечные пользователи предупреждают поставщиков о наличии ошибок 92 проблем, предоставляя информацию разработчику. Затем Microsoft Corporation исправит ошибки и подготовит файл обновления для загрузки. Эта ситуация происходит из-за обновления программного обеспечения Windows Operating System является одним из решений ошибок 92 ошибок и других проблем.

Почему происходит ошибка времени выполнения 92?

Вполне вероятно, что при загрузке Windows Operating System вы столкнетесь с «For loop not initialized». Причины сбоев обработки можно отличить, классифицируя ошибки 92 следующим образом:.

Ошибка 92 Crash — это типичная ошибка 92 во время выполнения, которая полностью аварийно завершает работу компьютера. Это происходит много, когда продукт (Windows Operating System) или компьютер не может обрабатывать уникальные входные данные.

«For loop not initialized» Утечка памяти — Ошибка 92 утечка памяти происходит и предоставляет Windows Operating System в качестве виновника, перетаскивая производительность вашего ПК. Потенциальные триггеры могут быть бесконечным циклом, что приводит к тому, что работа программы запускается снова и снова.

Ошибка 92 Logic Error — Логические ошибки проявляются, когда пользователь вводит правильные данные, но устройство дает неверный результат. Обычные причины этой проблемы связаны с ошибками в обработке данных.

Такие проблемы For loop not initialized обычно вызваны повреждением файла, связанного с Windows Operating System, или, в некоторых случаях, его случайным или намеренным удалением. Как правило, любую проблему, связанную с файлом Microsoft Corporation, можно решить посредством замены файла на новую копию. Если ошибка For loop not initialized возникла в результате его удаления по причине заражения вредоносным ПО, мы рекомендуем запустить сканирование реестра, чтобы очистить все недействительные ссылки на пути к файлам, созданные вредоносной программой.

Ошибки For loop not initialized

Типичные ошибки For loop not initialized, возникающие в Windows Operating System для Windows:

  • «Ошибка программного обеспечения For loop not initialized. «
  • «Ошибка программного обеспечения Win32: For loop not initialized»
  • «For loop not initialized столкнулся с проблемой и закроется. «
  • «For loop not initialized не может быть найден. «
  • «Отсутствует файл For loop not initialized.»
  • «Ошибка запуска программы: For loop not initialized.»
  • «For loop not initialized не выполняется. «
  • «Ошибка For loop not initialized. «
  • «Неверный путь к приложению: For loop not initialized.»

Проблемы Windows Operating System For loop not initialized возникают при установке, во время работы программного обеспечения, связанного с For loop not initialized, во время завершения работы или запуска или менее вероятно во время обновления операционной системы. Отслеживание того, когда и где возникает ошибка For loop not initialized, является важной информацией при устранении проблемы.

Корень проблем For loop not initialized

Эти проблемы For loop not initialized создаются отсутствующими или поврежденными файлами For loop not initialized, недопустимыми записями реестра Windows Operating System или вредоносным программным обеспечением.

В частности, проблемы с For loop not initialized, вызванные:

  • Недопустимый For loop not initialized или поврежденный раздел реестра.
  • Вирус или вредоносное ПО, которые повредили файл For loop not initialized или связанные с Windows Operating System программные файлы.
  • Вредоносное удаление (или ошибка) For loop not initialized другим приложением (не Windows Operating System).
  • For loop not initialized конфликтует с другой программой (общим файлом).
  • Неполный или поврежденный Windows Operating System (For loop not initialized) из загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

How to fix the Runtime Code 92 For loop not initialized

This article features error number Code 92, commonly known as For loop not initialized described as For loop counters must be initialized.

About Runtime Code 92

Runtime Code 92 happens when Windows fails or crashes whilst it’s running, hence its name. It doesn’t necessarily mean that the code was corrupt in some way, but just that it did not work during its run-time. This kind of error will appear as an annoying notification on your screen unless handled and corrected. Here are symptoms, causes and ways to troubleshoot the problem.

Definitions (Beta)

Here we list some definitions for the words contained in your error, in an attempt to help you understand your problem. This is a work in progress, so sometimes we might define the word incorrectly, so feel free to skip this section!

  • Loop — Loops are a type of control flow structure in programming in which a series of statements may be executed repeatedly until some condition is met.

Symptoms of Code 92 — For loop not initialized

Runtime errors happen without warning. The error message can come up the screen anytime Windows is run. In fact, the error message or some other dialogue box can come up again and again if not addressed early on.

There may be instances of files deletion or new files appearing. Though this symptom is largely due to virus infection, it can be attributed as a symptom for runtime error, as virus infection is one of the causes for runtime error. User may also experience a sudden drop in internet connection speed, yet again, this is not always the case.

Fix For loop not initialized (Error Code 92)
(For illustrative purposes only)

Causes of For loop not initialized — Code 92

During software design, programmers code anticipating the occurrence of errors. However, there are no perfect designs, as errors can be expected even with the best program design. Glitches can happen during runtime if a certain error is not experienced and addressed during design and testing.

Runtime errors are generally caused by incompatible programs running at the same time. It may also occur because of memory problem, a bad graphics driver or virus infection. Whatever the case may be, the problem must be resolved immediately to avoid further problems. Here are ways to remedy the error.

Repair Methods

Runtime errors may be annoying and persistent, but it is not totally hopeless, repairs are available. Here are ways to do it.

If a repair method works for you, please click the upvote button to the left of the answer, this will let other users know which repair method is currently working the best.

Please note: Neither ErrorVault.com nor it’s writers claim responsibility for the results of the actions taken from employing any of the repair methods listed on this page — you complete these steps at your own risk.

Method 1 — Close Conflicting Programs

When you get a runtime error, keep in mind that it is happening due to programs that are conflicting with each other. The first thing you can do to resolve the problem is to stop these conflicting programs.

  • Open Task Manager by clicking Ctrl-Alt-Del at the same time. This will let you see the list of programs currently running.
  • Go to the Processes tab and stop the programs one by one by highlighting each program and clicking the End Process buttom.
  • You will need to observe if the error message will reoccur each time you stop a process.
  • Once you get to identify which program is causing the error, you may go ahead with the next troubleshooting step, reinstalling the application.

Method 2 — Update / Reinstall Conflicting Programs

Using Control Panel

  • For Windows 7, click the Start Button, then click Control panel, then Uninstall a program
  • For Windows 8, click the Start Button, then scroll down and click More Settings, then click Control panel > Uninstall a program.
  • For Windows 10, just type Control Panel on the search box and click the result, then click Uninstall a program
  • Once inside Programs and Features, click the problem program and click Update or Uninstall.
  • If you chose to update, then you will just need to follow the prompt to complete the process, however if you chose to Uninstall, you will follow the prompt to uninstall and then re-download or use the application’s installation disk to reinstall the program.

Using Other Methods

  • For Windows 7, you may find the list of all installed programs when you click Start and scroll your mouse over the list that appear on the tab. You may see on that list utility for uninstalling the program. You may go ahead and uninstall using utilities available in this tab.
  • For Windows 10, you may click Start, then Settings, then choose Apps.
  • Scroll down to see the list of Apps and features installed in your computer.
  • Click the Program which is causing the runtime error, then you may choose to uninstall or click Advanced options to reset the application.

Method 3 — Update your Virus protection program or download and install the latest Windows Update

Virus infection causing runtime error on your computer must immediately be prevented, quarantined or deleted. Make sure you update your virus program and run a thorough scan of the computer or, run Windows update so you can get the latest virus definition and fix.

Method 4 — Re-install Runtime Libraries

You might be getting the error because of an update, like the MS Visual C++ package which might not be installed properly or completely. What you can do then is to uninstall the current package and install a fresh copy.

  • Uninstall the package by going to Programs and Features, find and highlight the Microsoft Visual C++ Redistributable Package.
  • Click Uninstall on top of the list, and when it is done, reboot your computer.
  • Download the latest redistributable package from Microsoft then install it.

Method 5 — Run Disk Cleanup

You might also be experiencing runtime error because of a very low free space on your computer.

  • You should consider backing up your files and freeing up space on your hard drive
  • You can also clear your cache and reboot your computer
  • You can also run Disk Cleanup, open your explorer window and right click your main directory (this is usually C: )
  • Click Properties and then click Disk Cleanup

Method 6 — Reinstall Your Graphics Driver

If the error is related to a bad graphics driver, then you may do the following:

  • Open your Device Manager, locate the graphics driver
  • Right click the video card driver then click uninstall, then restart your computer

Method 7 — IE related Runtime Error

If the error you are getting is related to the Internet Explorer, you may do the following:

  1. Reset your browser.
    • For Windows 7, you may click Start, go to Control Panel, then click Internet Options on the left side. Then you can click Advanced tab then click the Reset button.
    • For Windows 8 and 10, you may click search and type Internet Options, then go to Advanced tab and click Reset.
  2. Disable script debugging and error notifications.
    • On the same Internet Options window, you may go to Advanced tab and look for Disable script debugging
    • Put a check mark on the radio button
    • At the same time, uncheck the «Display a Notification about every Script Error» item and then click Apply and OK, then reboot your computer.

If these quick fixes do not work, you can always backup files and run repair reinstall on your computer. However, you can do that later when the solutions listed here did not do the job.

Other languages:

Wie beheben Fehler 92 (For-Schleife nicht initialisiert) — For-Schleifenzähler müssen initialisiert werden.
Come fissare Errore 92 (Ciclo For non inizializzato) — Per i contatori loop devono essere inizializzati.
Hoe maak je Fout 92 (For-lus niet geïnitialiseerd) — Voor lustellers moeten worden geïnitialiseerd.
Comment réparer Erreur 92 (Boucle for non initialisée) — Les compteurs de boucle for doivent être initialisés.
어떻게 고치는 지 오류 92 (For 루프가 초기화되지 않음) — For 루프 카운터를 초기화해야 합니다.
Como corrigir o Erro 92 (Loop For não inicializado) — Para os contadores de loop devem ser inicializados.
Hur man åtgärdar Fel 92 (För loop inte initierad) — För slingräknare måste initialiseras.
Как исправить Ошибка 92 (Для цикла не инициализирован) — Ибо счетчики циклов должны быть инициализированы.
Jak naprawić Błąd 92 (Pętla For nie została zainicjowana) — Dla liczników pętli należy zainicjować.
Cómo arreglar Error 92 (For bucle no inicializado) — Para los contadores de bucle se deben inicializar.

The Author About The Author: Phil Hart has been a Microsoft Community Contributor since 2010. With a current point score over 100,000, they’ve contributed more than 3000 answers in the Microsoft Support forums and have created almost 200 new help articles in the Technet Wiki.

Follow Us: Facebook Youtube Twitter

Last Updated:

15/09/21 08:11 : A iPhone user voted that repair method 2 worked for them.

Recommended Repair Tool:

This repair tool can fix common computer problems such as blue screens, crashes and freezes, missing DLL files, as well as repair malware/virus damage and more by replacing damaged and missing system files.

STEP 1:

Click Here to Download and install the Windows repair tool.

STEP 2:

Click on Start Scan and let it analyze your device.

STEP 3:

Click on Repair All to fix all of the issues it detected.

DOWNLOAD NOW

Compatibility

Requirements

1 Ghz CPU, 512 MB RAM, 40 GB HDD
This download offers unlimited scans of your Windows PC for free. Full system repairs start at $19.95.

Article ID: ACX04746EN

Applies To: Windows 10, Windows 8.1, Windows 7, Windows Vista, Windows XP, Windows 2000

Speed Up Tip #83

Setup Multiple Drives:

If you are an advanced user, you can boost your system performance by installing multiple hard drives into your computer. Then, you can set these new drives into a RAID 0 to make a fast single virtual drive. You can also, set up RAID 5 or any of the other RAID configurations depending on your needs.

Click Here for another way to speed up your Windows PC

Microsoft & Windows® logos are registered trademarks of Microsoft. Disclaimer: ErrorVault.com is not affiliated with Microsoft, nor does it claim such affiliation. This page may contain definitions from https://stackoverflow.com/tags under the CC-BY-SA license. The information on this page is provided for informational purposes only. © Copyright 2018

  1. 01-09-2018, 03:50 AM


    #1

    Error 92.For loop not initialized

    Hi

    In one of my Dictator Excel Applications. I am encountering the «Error 92, For loop not initialized» error.The Error does not let the workbook opened with any sheet. It just shows a blank instance of Excel (Snap attached).For some reasons I am unable to attach the workbook for some reasons. Although I am sharing the Workbook_open() Code as it shows the error on opening.May some suggestions/solutions be provided with out the book attached?
    whats wrong with the code bellow:

    Last edited by ImranBhatti; 01-09-2018 at 12:40 PM.

    Teach me Excel VBA


  2. 01-09-2018, 04:24 AM


    #2

    Re: Error 92.For loop not initialized

    Hi

    Have you trusted access to the VBA project in the trust centre?

    Don
    Please remember to mark your thread ‘Solved’ when appropriate.


  3. 01-09-2018, 04:30 AM


    #3

    Re: Error 92.For loop not initialized

    Sir the «Trust Access to the VBA Project to object Model» is ticked.


  4. 01-09-2018, 04:31 AM


    #4

    Re: Error 92.For loop not initialized

    Perhaps the issue is related to the fact that your product activation of Excel seems to have failed on that computer.


  5. 01-09-2018, 04:47 AM


    #5

    Re: Error 92.For loop not initialized

    The Microsoft Office Activation wizard does pop up for every instance of Excel but other files have no issue.


  6. 01-09-2018, 04:48 AM


    #6

    Re: Error 92.For loop not initialized

    Do the other files have the same code in?


  7. 01-09-2018, 04:59 AM


    #7

    Re: Error 92.For loop not initialized

    I am confirming the code equality of the file with others.


  8. 01-09-2018, 11:21 AM


    #8

    Re: Error 92.For loop not initialized

    Yes the code is same for all books.


  9. 01-09-2018, 11:25 AM


    #9

    Re: Error 92.For loop not initialized

    Are you sure the error is in that code? If so, on which line?

    The code itself is, in my opinion, hard to follow due to the large number of redundant commented out lines, and also contains a fair amount of seemingly pointless code (e.g. enabling events from a Workbook_open event which wouldn’t be running if events were not enabled). Furthermore, assuming that code is in an add-in, there does not appear to be an active workbook- something to which it refers frequently.


  10. 01-09-2018, 12:43 PM


    #10

    Re: Error 92.For loop not initialized

    I have tested and now make the lines as red in the first post. The error message pops up as it is concatenated in the error handler(Red lines).
    And the last line that executes before reaching to message box is also red above.


  11. 01-09-2018, 12:49 PM


    #11

    Re: Error 92.For loop not initialized

    I don’t see how you could get to the red line, if the For loop (which precedes it) is in error. Is there any event code in the DataValues sheet?


  12. 01-09-2018, 12:53 PM


    #12

    Re: Error 92.For loop not initialized

    Yes
    The «DataValues» sheet has the following code


  13. 01-09-2018, 12:59 PM


    #13

    Re: Error 92.For loop not initialized

    I honestly cannot see anything in the code that is incorrect, so I’m afraid the onus is on you to do some debugging since you have the actual workbook in front of you.


  14. 01-09-2018, 01:07 PM


    #14

    Re: Error 92.For loop not initialized

    Yes I understand that it is too difficult to help by looking a piece of code of a large application.I will try to debug it as prescribed and let you know the come outs.

    Thanks a lot for trying so hard to help out.

    Best Regards
    Imran Bhatti


  15. 01-09-2018, 01:14 PM


    #15

    Re: Error 92.For loop not initialized

    If you can provide the workbook, I will try and help further but I realise that may not be an option.


  • Home
  • VBForums
  • Visual Basic
  • Visual Basic 6 and Earlier
  • Error 92 For loop not initialized

  1. Mar 28th, 2004, 10:21 PM


    #1

    matrixau is offline

    Thread Starter


    Lively Member


    Error 92 For loop not initialized

    what does this eeror mean??

    i run my prog on win 2k/XP and works fine

    i run it on NT and get the error «For loop not initialized»

    does this mean it wont work on NT?
    or can i fix it

    thanks


  2. Mar 28th, 2004, 10:30 PM


    #2

    How about showing some code?

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.

    Take credit, not responsibility


  3. Mar 28th, 2004, 10:53 PM


    #3

    matrixau is offline

    Thread Starter


    Lively Member


    Code:

    Private Function Getfolders(sStartFolder As String) As String
        On Error Resume Next
    
        Dim fso As New FileSystemObject
        Dim f As Folder
        Dim fldr As Folder
        Set fldr = fso.GetFolder(sStartFolder)
        Getfolders = fldr.Path & vbCrLf
        If fldr.SubFolders.Count > 0 And Getfolders <> "" Then
            For Each f In fldr.SubFolders
              Getfolders = Getfolders & Getfolders(f.Path)
            Next f
        End If
    End Function

    Code:

     
    Private Function ListShares(strComputer As String) As String
        On Error Resume Next
    
        Dim strObject, objPrintJobSet
        Dim objWMIService, colItems, objItem, i
        
        Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_Share")
        
        i = 0
    
        For Each objItem In colItems
            rtbResults.SelColor = RGB(0, 0, 255)
            rtbResults.SelText = rtbResults.SelText & "Share: " & objItem.Name & vbCrLf
            
            rtbResults.SelColor = RGB(100, 0, 200)
            rtbResults.SelText = rtbResults.SelText & "Path: " & Trim(objItem.Path) & vbCrLf
    
            rtbResults.SelColor = RGB(100, 0, 100)
            rtbResults.SelText = rtbResults.SelText & "Type: " & strType(objItem.Type) & vbCrLf
    
            sbStatus.Panels.Item(2).Width = 1500
            sbStatus.Panels.Item(2).Text = "Share: " & objItem.Name
            
            DoEvents
            
            If Trim(objItem.Path) <> "" Then
                rtbResults.SelColor = RGB(220, 120, 0)
                Select Case objItem.Type
                    Case 0
                        Call AllFolders(Trim(objItem.Path))
                        rtbResults.SelColor = RGB(255, 0, 0)
                        rtbResults.SelText = rtbResults.SelText & "********************************************************************************************************************************************************************************************************************************************************************************************************" & vbCrLf
                    'Case -2147483648#
                        'Call AllFolders(objItem.Path)
                    Case Else
                        rtbResults.SelColor = RGB(255, 0, 0)
                        rtbResults.SelText = rtbResults.SelText & "********************************************************************************************************************************************************************************************************************************************************************************************************" & vbCrLf
                End Select
            Else
                rtbResults.SelColor = RGB(255, 0, 0)
                rtbResults.SelText = rtbResults.SelText & "********************************************************************************************************************************************************************************************************************************************************************************************************"
            End If
        Next
        
        Set objWMIService = Nothing
        Set colItems = Nothing
    End Function

    those functions are the only ones with for loops in my code

    basically what i do is list all the shares on the drive
    then list all subdirectories within the share


  4. Mar 29th, 2004, 10:41 AM


    #4

    You didn’t check if set returns an object or is nothing before running the loops. Add soe error handling.


  5. Mar 29th, 2004, 07:48 PM


    #5

    matrixau is offline

    Thread Starter


    Lively Member


    ok im getting this other error

    Error: -2147221020
    Automation error
    Invalid syntax

    this is in the function «ListShares»

    instead of resume next i put in a err handler and it displays that error


  6. Mar 29th, 2004, 08:00 PM


    #6

    matrixau is offline

    Thread Starter


    Lively Member


    could it be that WMI has to be installed?

    Set objWMIService = GetObject(«winmgmts:\» & strComputer & «rootcimv2»)
    Set colItems = objWMIService.ExecQuery(«Select * from Win32_Share»)


  7. Mar 29th, 2004, 08:22 PM


    #7

    Where exactly are you getting the error?
    Take out the On Error Resume Next and see what line is generating the error.

    VB/Office Guru� (AKA: Gangsta Yoda)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru� Word SpellChecker�.NETVB/Office Guru� Word SpellChecker� VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24″ LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6


  8. Mar 29th, 2004, 10:54 PM


    #8

    matrixau is offline

    Thread Starter


    Lively Member


    error in this function

    could be that i need wmi installed

    Code:

    Private Function ListShares(strComputer As String) As String
        On Error Resume Next
    
        Dim strObject, objPrintJobSet
        Dim objWMIService, colItems, objItem, i
        
        Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_Share")
        
        i = 0
    
        For Each objItem In colItems
            rtbResults.SelColor = RGB(0, 0, 255)
            rtbResults.SelText = rtbResults.SelText & "Share: " & objItem.Name & vbCrLf
            
            rtbResults.SelColor = RGB(100, 0, 200)
            rtbResults.SelText = rtbResults.SelText & "Path: " & Trim(objItem.Path) & vbCrLf
    
            rtbResults.SelColor = RGB(100, 0, 100)
            rtbResults.SelText = rtbResults.SelText & "Type: " & strType(objItem.Type) & vbCrLf
    
            sbStatus.Panels.Item(2).Width = 1500
            sbStatus.Panels.Item(2).Text = "Share: " & objItem.Name
            
            DoEvents
            
            If Trim(objItem.Path) <> "" Then
                rtbResults.SelColor = RGB(220, 120, 0)
                Select Case objItem.Type
                    Case 0
                        Call AllFolders(Trim(objItem.Path))
                        rtbResults.SelColor = RGB(255, 0, 0)
                        rtbResults.SelText = rtbResults.SelText & " ****************************************************************************************************
     ****************************************************************************************************
    ************************************************************************************************" & vbCrLf
                    'Case -2147483648#
                        'Call AllFolders(objItem.Path)
                    Case Else
                        rtbResults.SelColor = RGB(255, 0, 0)
                        rtbResults.SelText = rtbResults.SelText & " ****************************************************************************************************
     ****************************************************************************************************
    ************************************************************************************************" & vbCrLf
                End Select
            Else
                rtbResults.SelColor = RGB(255, 0, 0)
                rtbResults.SelText = rtbResults.SelText & " ****************************************************************************************************
     ****************************************************************************************************
    ************************************************************************************************"
            End If
        Next
        
        Set objWMIService = Nothing
        Set colItems = Nothing
    End Function


  9. Mar 29th, 2004, 11:09 PM


    #9

    Set a breakpoint at this line — «Private Function ListShares
    (strComputer As String) As String
    » and step through the code by pressing F8 one at a time, but
    comment out the On Error Resume next. Then if it errors on
    the «Set objWMIService = GetObject(«winmgmts:\» &
    strComputer & «rootcimv2″)» then it is not installed. Check in
    the Winntsystem32 directory for «wscript.exe»

    VB/Office Guru� (AKA: Gangsta Yoda)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru� Word SpellChecker�.NETVB/Office Guru� Word SpellChecker� VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24″ LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6


  • Home
  • VBForums
  • Visual Basic
  • Visual Basic 6 and Earlier
  • Error 92 For loop not initialized


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  • BB code is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML code is Off

Forum Rules


Click Here to Expand Forum to Full Width

Понравилась статья? Поделить с друзьями:

Читайте также:

  • For honor ошибка подключения ps4
  • For honor ошибка 30005
  • For honor как изменить озвучку
  • For honor как изменить ник
  • For event in pygame event get pygame error video system not initialized

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии