• Strange Behavior

    • This topic has 13 replies, 4 voices, and was last updated 24 years ago.
    Author
    Topic
    #353713

    I have the following line of code in my userform:

    calltime.Value = Format(TimeValue(Timebox.Value) + TimeValue(cbtimebox.Value), “hh:mm:ss”)

    I am using Office 97 SR-2.
    The problem is some users are running O97 OEM, which does not like the “Format” command.

    Does anyone have any insight as to how I can fix this?

    Viewing 1 reply thread
    Author
    Replies
    • #518073

      I really don’t understand why that does not work on the “OEM” version of Excel 97. As far as I know, the Format function has been in VBA since the beginning. What kind of error are you getting?

      You might try the following:

          calltime.Value = Application.WorksheetFunction.Text(TimeValue(Timebox.Value) + _ 
              TimeValue(cbtimebox.Value), "hh:mm:ss")
      
      • #518148

        The error reads as follows:

        Compile Error:

        Can’t find project or library.

        It then focuses on the format command in the statement, in fact, it focuses on all format commands in the code… (I attempted to rem the code and proceed, but it pinpointed other format commands as well…)

        I have a splash screen with the following code which is supposed to load before anything:

        ***CODE START***
        Private Declare Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)

        Private Sub UserForm_Activate()
        DoEvents
        Image2.Visible = True
        Sleep 100
        DoEvents
        Image2.Visible = False
        Image3.Visible = True
        Sleep 100
        DoEvents
        Sleep 2000
        Unload Me
        End Sub
        ****CODE END****

        Would this adversly effect the performance?

        Drk.

        • #518188

          That error message indicates that there is no reference set to the VBA object library. From the VBA editor, select References from the Tools menu. Make sure that there is a check next to “Visual Basic for Applications.”

          What do you mean by adversly affect performance? With those sleep statements, it is certainly going to slow down the startup. However, once that is finished, it should not affect anything else.

          • #518191

            The sleep statements are setup so that a series of graphics on the splash screen will emulate animation… I was able to correct the problem by removing the reference to Windows Media Player… i’m still baffled as to how that got there..

            Thanks for all your help!

            Drk.

            • #526696

              Good day!

              I have a very similar problem. The difference seems is that my code is breaking on a Right() procedure calls (it will also break at a Format() call if I comment out the first one).

              I recently transfered my projects to a different PC, and the old PC has already been re-imaged.

              In my references, I have found that “Visual Basic for Applications” is selected, pointing to VBA332.DLL. There are three other “Visual Basic for Applications” references that are not selected, but the VBA editor won’t let me select them – it says I’m not allowed to select the same reference names twice.

              I also have a MISSING: reference, “Microsoft Scriplet Component”, and the file doesn’t exist anywhere on my PC. But I don’t believe that Right() and Format() procedure calls have anything to do with that library, do they?

              I’m perplexed by this situation, and I appear to be the only person my company who knows anything at all about VBA.

              Once I get this to work on my PC, can I only hope that my end-users’ PC’s will have the same libraries? (I guess they should have the company std which should be the same as mine).

              Can anyone help?

              Thanks,
              Rob

    • #518156

      Have you checked the references in your VB project to see if any are missing? That has a habit of causing errors with functions.

      • #518158

        How would I check the references? and, are they machine specific? It runs on my machine, and my partners… but it’s not running on the end users’ machines… i’m boggled!

        • #518160

          Open the VBEditor and select Tools-References and look for any that start with ‘MISSING:’. The references are specific to the project which is why it can work on some and not on others – the file that is being referenced needs to be on the machine in question. Check any one of the PCs that it doesn’t work on (I’m assuming that all your users’ PCs are pretty much the same)

          • #518161

            If any are missing, is there a place I can go to get them?

            Thanks!

            • #518163

              depends what it is! If it’s a reference to a project or dll that you’ve created then you just need to install a copy in the correct place on each user’s machine. If it’s something you have access to because, for example, you have a particular piece of software that they don’t have, then it’s a question of whether you need a licence to use it. First step is to find out what it is (assuming there is something missing). Then you can try and figure out a way around it!

            • #518165

              It was missing Windows Media Player… this is especially baffling, because I have no *apparent* media tags or fields in my database…

              Now that I know it’s referencing windows media player, how can I locate and remove that reference?

              Thanks again!

            • #518166

              Simply unchecking the reference should do it. (unless you want to install it (Media Player) on all their machines? ) If you have a central copy of your workbook do it in that, otherwise change your master copy and then overwrite all their individual copies.
              Hope that helps.

            • #518168

              That did it.. done.. joy!

              Thanks for all your help Rory!

    Viewing 1 reply thread
    Reply To: Strange Behavior

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: