+ Reply to Thread
Results 1 to 6 of 6

Error while executing a procedure.

  1. #1
    Registered User
    Join Date
    11-12-2007
    Posts
    3

    Error while executing a procedure.

    Hi all,

    I was working one a VBA procedure all day long and everything was fine, but suddenly every time I try to execute a procedure I got following error message:

    "Compile error: Expected Function or Variable".

    and Selection is beeing marked (see code)

    I have no idea, what is the reason for this error massage.
    I will appreciate any help.

    My code is following (please be aware that I am a very beginner in VBA):


    Please Login or Register  to view this content.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why are you using this [iColor] here?
    Please Login or Register  to view this content.
    folder is not declared as a variable, nor a value given to it
    Please Login or Register  to view this content.
    What is template? Is it a String variable & if so where do you define it?
    Please Login or Register  to view this content.
    Also, you don't need to Select and Activate as your code does.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello 06035,

    The error is most likely occurring in the beginning of your code with ChDir statement. Your path variable Folder hasn't been assigned a path.

    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    11-12-2007
    Posts
    3
    Thanks for your replays.

    Why are you using this [iColor] here?
    Sorry my mistake, I wanted to color something in my code in this post, but then I have changed my mind and have forgotten to delete it. Of course I do not have this in my Excel VBA code.

    so where do you define it?
    Again my fault I have forgotten to give you this information.

    I have defined variables in ThisWorkbook - Workbook - Open as follows:

    Please Login or Register  to view this content.
    And I have also in my module under General - Declarations

    Public template As String
    Public folder As String
    Public source As String
    Public where As String
    Public name As String
    Option Explicit
    Hope I have made my mind clearer now.

    Regards,
    Patryk

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Wecan't see what the values you are assigning are, maybe you should zip & attach the workbook.

  6. #6
    Registered User
    Join Date
    11-12-2007
    Posts
    3
    maybe you should zip & attach the workbook.
    Please find attached file. Let me know if the source file will be useful.

    Regards,
    Patryk
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1