Why do I get a "Loop without Do" compile error on the following code

Diskutiere und helfe bei Why do I get a "Loop without Do" compile error on the following code im Bereich Microsoft Office im Windows Info bei einer Lösung; Do Until i = 10 MsgBox "i = " & i i = i + 1 Loop Until i = 5 Dieses Thema im Forum "Microsoft Office" wurde erstellt von Heimo11, 10. November 2023.

  1. Heimo11
    Heimo11 Gast

    Why do I get a "Loop without Do" compile error on the following code


    Do Until i = 10 MsgBox "i = " & i i = i + 1 Loop Until i = 5
     
  2. bozweifel Win User

    SQL in Access VBA

    Hi Peter

    I am sorry but I don’t understand why your code works perfectly. I thought to have read that numbers do not need quotation marks and lngProductID = Me!lstBox2.Value is a number that is read out from a form that is open at the time the code is run.
    I have even less appreciation for the ampersands, but if they do the job they can stay where you put them.



    So, thanks for your professional help, boz
  3. Andreas Killer Win User

    Word 2016 per VBA nach Zeit schließen

    Den Code kannst Du vergessen, das geht so schon lange nicht mehr.

    Mach mal eine neue Datei

    VBA Editor auf

    Userform einfügen

    Auf diese einen Label (den etwas größer machen) und einen CommandButton

    Dann diesen Code in die Userform

    Option Explicit
    
    Private Sub CommandButton1_Click()
    
      Unload Me
    
    End Sub
    Dann den Code unten in das Codemodul ThisDocument

    Datei speichern, schließen und wieder öffnen

    Abwarten was passiert. Alles klar?

    Andreas.

    Option Explicit
    
    Dim WithEvents App As Application
    
    Dim Inactivity As Date, CountDown As Date
    
    Private Sub App_WindowSelectionChange(ByVal Sel As Selection)
    
      'Restart the timer if the selection changes
    
      RestartTimer
    
    End Sub
    
    Private Sub Document_Open()
    
      'The AutoClose windows pops uo after this time of inactivity
    
      Inactivity = TimeSerial(0, 0, 5)
    
      'The Autpclose has a countdown timer, 10 seconds + 1 to let the window pop up
    
      CountDown = TimeSerial(0, 0, 11)
    
      'Activate the event
    
      Set App = Application
    
      'Start the timer
    
      RestartTimer
    
    End Sub
    
    Private Sub RestartTimer()
    
      Application.OnTime Now + Inactivity, Me.CodeName & ".AutoCloseMe"
    
    End Sub
    
    Public Sub AutoCloseMe()
    
      Const Msg = "File will be closed in x without saving!"
    
      Dim T As Date
    
      'Errors off, we get an error if the AutoClose window is closed
    
      On Error GoTo ExitPoint
    
      'Load the form
    
      Load UserForm1
    
      With UserForm1
    
        'Prepare the form
    
        .Caption = "Auto Close Timer"
    
        With .CommandButton1
    
          .Caption = "Abort"
    
          'ESC or ENTER triggers the button
    
          .Default = True
    
          .Cancel = True
    
        End With
    
        'Show it modeless means the userform pop up and the code continuos here immediatly
    
        .Show vbModeless
    
        'Wait until the form is visible
    
        Do While Not .Visible
    
          DoEvents
    
        Loop
    
        'Calculate the end time
    
        T = Timer / 86400 + CountDown
    
        'Perform the count down
    
        Do While T > Timer / 86400
    
          'Update the message
    
          .Label1 = Replace(Msg, "x", T - Timer / 86400)
    
          'Let the window update
    
          DoEvents
    
          'Are we on screen?
    
          If Not .Visible Then GoTo ExitPoint
    
        Loop
    
      End With
    
      'If we get here, the user is away
    
      On Error Resume Next
    
      Unload UserForm1
    
      ThisDocument.Close False
    
      Exit Sub
    
    ExitPoint:
    
      'We noticed an action, restart
    
      Unload UserForm1
    
      RestartTimer
    
    End Sub
    
    
  4. Nik S. Win User

    Onedrive Sync problems

    Hi stanko,

    To look further, could you please provide me with the screenshot rename error or pop-up that you get.

    Do you get this error due to an invalid filename? Also, have you prompted to change the file name on your PC or online?

    Regards

    Nik
  5. Gunasekar5034 Win User

    Microsoft Nicht-Abo-Nutzer

    Hi Veronika R,

    I’m Gunasekar and I will be happy to help you with your question, I am a Microsoft consumer like you.

    We can understand the problem at your end as it affects your work and we’re willing to help you in order to resolve the problem. So, to move further regarding this issue, we would like you to provide the following information:

    1. May I please know the version, edition, and OS Build of the operating system installed on your computer?
    2. Could you please provide us with a full screenshot of the error message for our reference? Please click on Use rich formatting to insert a screenshot and select the Insert Image icon?
    3. Did you make any recent software changes to the computer?
    4. Do you get any error code/message when signing in with your Microsoft account to activate Office?

    I hope this information helps. If you have any questions, please let me know and I’ll be glad to assist you further.

    Best regards,

    Gunasekar N
  6. FelixTiefenthaler Win User

    Excel formatting problem

    Hi Dave,
    <br />Thanks
    <br />But what if I need such a large number for calculations, the one with the ´ is no longer a number?
    <br />If you do not know why this is the case, it is not a drag because I do not need a calculation for my current case.
    <br />Is just to expand my knowledge.
    <br />Sincerely, Felix
    <br />
  7. User Advert


    Hi,

    willkommen im Windows Forum!
Thema:

Why do I get a "Loop without Do" compile error on the following code - Microsoft Office

Die Seite wird geladen...

Why do I get a "Loop without Do" compile error on the following code - Similar Threads - Why get Loop

Forum Datum

Why do I get so many Bsod's lately

Why do I get so many Bsod's lately: Hi there, I got a really annoying problem and posted it already on reddit https://www.reddit.com/r/techsupport/comments/1jpkpw6/bsods_so_often/, so I thought I try as many channels as possible. I...
Apps 2. April 2025

Why do I get so many Bsod's lately

Why do I get so many Bsod's lately: Hi there, I got a really annoying problem and posted it already on reddit https://www.reddit.com/r/techsupport/comments/1jpkpw6/bsods_so_often/, so I thought I try as many channels as possible. I...
Games und Spiele 2. April 2025

How do matches get into the bookie’s line?

How do matches get into the bookie’s line?: Some matches are in the line, others aren’t. I’ve read that the line isn’t just what the bookie prefers or the top events, it should be all the available matches for betting right now. But still,...
Windows Insider 5. Februar 2025

Fortnite crashes on start and I get following error in event log

Fortnite crashes on start and I get following error in event log: Name der fehlerhaften Anwendung: lsass.exe, Version: 10.0.22621.3235, Zeitstempel: 0xf73de5daName des fehlerhaften Moduls: unknown, Version: 0.0.0.0, Zeitstempel: 0x00000000Ausnahmecode:...
Apps 29. Oktober 2024

Fortnite crashes on start and I get following error in event log

Fortnite crashes on start and I get following error in event log: Name der fehlerhaften Anwendung: lsass.exe, Version: 10.0.22621.3235, Zeitstempel: 0xf73de5daName des fehlerhaften Moduls: unknown, Version: 0.0.0.0, Zeitstempel: 0x00000000Ausnahmecode:...
Games und Spiele 29. Oktober 2024

why do I have extra languages?

why do I have extra languages?: I deleted them, but they sometimes appear after restarting my laptop, I can't delete them because I don't have them in my languages list, so I need to restart my laptop again for them to disappear
Apps 6. November 2022

why do I have extra languages?

why do I have extra languages?: I deleted them, but they sometimes appear after restarting my laptop, I can't delete them because I don't have them in my languages list, so I need to restart my laptop again for them to disappear
Games und Spiele 6. November 2022
Why do I get a "Loop without Do" compile error on the following code solved
  1. Diese Seite verwendet Cookies, um Inhalte zu personalisieren, diese deiner Erfahrung anzupassen und dich nach der Registrierung angemeldet zu halten.
    Auf dieser Website werden Cookies für die Zugriffsanalyse und Anzeigenmessung verwendet.
    Wenn du dich weiterhin auf dieser Seite aufhältst, akzeptierst du unseren Einsatz von Cookies.