Results 1 to 9 of 9

Thread: whats wrong in this?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    5

    whats wrong in this?

    Sub testObjet()
    Dim feuil1 As Worksheet
    Dim y As Double
    Set feuil1 = worsheets(1)
    y = 127.66
    feuil1.Cells(1, 1) = y


    I get "Function or Sub not defined"...

    thanks for your help

  2. #2
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: whats wrong in this?

    TONS of things are wrong with it, and TBH if you can't work out what the mistakes are in that code then there is literally no hope whatsoever for you in the programming field.

    If, as I suspect, it is a question asked by your tutor, there's a reason why you were asked it and not us...because YOU need to learn how to find mistakes
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    5

    Re: whats wrong in this?

    I'm a real beginner... and I have been searching... I know ...shame on me... but it's not my tutor just trying to understand...

    Sorry about that

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,495

    Re: whats wrong in this?

    To start with you are opening with
    SUB testObjet()


    What is Sub testObjet()

    That is not valid code.
    Missing something at the end also
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: whats wrong in this?

    I know I sound like I'm being nasty, but jumping in at the deep end is definitely NOT the way to learn VB, esp. if you'll be an undue burden on the community here with all your questions...we don't mind answering proper questions when you're stuck with coding a program, but we do this voluntarily and someone who is going to ask as many questions as you will need to ask is soon going to get on our nerves :-P

    Find a tutorial somewhere, learn the basics, and most of all TRY to work out the answer without asking us for help...if you really get stuck then come to us, and if it's in much the same circumstances as this thread then I would say programming in VB6 is *definitely* not for you!
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,541

    Re: whats wrong in this?

    and sometimes it's a simple spelling mistake that could easily be over looked:
    worsheets(1)

    should be
    worksheets(1)

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: whats wrong in this?

    Quote Originally Posted by techgnome View Post
    should be
    worksheets(1)
    Should be worksheet(1) - NO s
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  8. #8
    Member
    Join Date
    Jan 2010
    Posts
    32

    Re: whats wrong in this?

    oh my.

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: whats wrong in this?

    Thread moved to 'Office Development/VBA' forum (note that the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt)

    loswillys, I recommend you read (and bookmark/save) the article What does this error mean, and how do I fix it? from our Classic VB FAQs (in the FAQ forum), as it gives you guidance for solving some of the more commonly seen errors.

    Quote Originally Posted by smUX
    Should be worksheet(1) - NO s
    No it shouldn't, because WorkSheets is a collection that contains WorkSheet objects.

    There is no implication whatsoever that loswillys has created a Collection/Array called WorkSheet
    Quote Originally Posted by smUX
    TONS of things are wrong with it, and TBH if you can't work out what the mistakes are in that code then there is literally no hope whatsoever for you in the programming field.
    Erm.. we all have to start somewhere. Knowing everything in advance certainly isn't a pre-requisite.
    Quote Originally Posted by smUX
    I know I sound like I'm being nasty, but jumping in at the deep end is definitely NOT the way to learn VB
    That is very debatable, many of us started in that way, and came out of it well.
    esp. if you'll be an undue burden on the community here with all your questions... we don't mind answering proper questions when you're stuck with coding a program, but we do this voluntarily and someone who is going to ask as many questions as you will need to ask is soon going to get on our nerves :-P
    I see this kind of thing from you regularly, and it is rather rude.

    You shouldn't make comments based on assumptions about how somebody will behave in the future based on just a couple of posts - instead you should either start by trying to push them in the right direction, or stay out of it until they improve their skills (or you have a reasonable amount of evidence to back up your assumptions).


    If you want to discuss this further, feel free to PM me (or any other moderator), as we don't want to derail this thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width