+ Reply to Thread
Results 1 to 12 of 12

Compile error: Variable not defined

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    Seoul, Korea
    MS-Off Ver
    Excel 2007
    Posts
    5

    Compile error: Variable not defined

    Hello everyone,

    I got this Excel file from a website. It is a utility for Primavera P6.

    Please do check this link to have a better understanding of the utility's function.

    http://www.plannertuts.com/primavera...t-the-sdk-840/

    Problem is...it ain't working. I think there's something wrong in it's VB.

    Appreciate your help guys.

    Thanks in advance!

    J

    P.S.

    I'm a novice in VB, I tried researching but can't break the ice
    Attached Files Attached Files

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Compile error: Variable not defined

    cannot load your file, because I get an 'Object not defined' error
    so....what is the offending object, or do you have some add-ins that are not a part of "Regular" VBA/Excel ? (I may not be the only person willing to look at, but, if we cant even get the file to open, that is not a good sign )
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Registered User
    Join Date
    01-16-2013
    Location
    Seoul, Korea
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Compile error: Variable not defined

    Hello dredwolf,

    Thank you very much for looking at my post!

    I got that file from

    http://www.plannertuts.com/primavera...t-the-sdk-840/

    I was able to open it but when I started following what it says on the tutorial, the embedded functions in Excel coded with VB doesn't seem to work.

    Below the tutorial were some comments concerning the same issue as mine which I followed through but still can't figure it out

    Hope someone will be able to solve the issue.

    Thanks again mate!

    Cheers,

    J

  4. #4
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Compile error: Variable not defined

    It was not a problem looking, it's just I can not open the file, keeps giving me the error, and while I am willing to go days on end without sleep, I am not sure I want to do it to solve someone else's (and I DO NOT mean you, the person who made this is who I mean) problem)...maybe someone else has used this before, but I am not willing to download such a flaky product, sorry

  5. #5
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Compile error: Variable not defined

    I had a quick look.

    The problem appears to be related to the usage of the Common Dialog control on one of the forms (frmPrompt).

    You can open the workbook by keeping the shift key pressed while the workbook is being opened by Excel to bypass any autostart code. The next step would be to goto Tools/References and to remove the Common Controls reference (which may be shown as missing).

    The next step would be to change the frmPrompt form (and underlying code) to use the standard available Excel File/Folder dialogue (i.e. Application.FileDialog(msoFileDialogFilePicker)
    to select the file to be processed.
    If you like my contribution click the star icon!

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Compile error: Variable not defined

    hi jrpuig1977, it looks you have library reference missing. You can check that by VBE - Tools - References. In order for the code to work there should be a checked reference for "Microsoft Common Dialog Control 6.0 (SP6)". I suppose it is missing in your case. To correct that click VBE - Tools - References - Browse and locate file: comdlg32.ocx, select it and click OK. Now when this reference is checked no such error should appear.

    PS. Basically that is the question to the developer/s for the product support

  7. #7
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Compile error: Variable not defined

    @watersev, you are entirely correct, but the funny thing is that I do not have the text "MISSING", but do get compilation errors.

    When I try to access the properties of the common dialog object on the form I get an error that the object has not been properly installed.

    As the object appears to be used for no other purposes of selecting a file object via a dialogue, I suggested to rewrite that bit of code. But he should indeed first check whether the missing reference suggestion solves the problem.

  8. #8
    Registered User
    Join Date
    01-16-2013
    Location
    Seoul, Korea
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Compile error: Variable not defined

    hi watersev, "Microsoft Common Dialog Control 6.0 (SP6)" is checked by default. When I got the fresh download of this file I cleared the object "MISSING" under tools, reference in VB.

    Now, following your advise (click VBE - Tools - References - Browse and locate file: comdlg32.ocx), I cannot locate the file comdlg32.ocx. I even tried to locate in windows search but cannot find it anywhere. What does this mean?

    Appreciate your time.

  9. #9
    Registered User
    Join Date
    01-16-2013
    Location
    Seoul, Korea
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Compile error: Variable not defined

    hi OllieB, thank you very much for your time.

    I cannot follow through your advise:
    "The next step would be to change the frmPrompt form (and underlying code) to use the standard available Excel File/Folder dialogue (i.e. Application.FileDialog(msoFileDialogFilePicker)
    to select the file to be processed."

    sorry mate i'm a novice in VB.

  10. #10
    Registered User
    Join Date
    01-16-2013
    Location
    Seoul, Korea
    MS-Off Ver
    Excel 2007
    Posts
    5

    [SOLVED]Re: Compile error: Variable not defined

    Hello guys!

    Problem sovled thru' watersev's advise.

    Cheers!

    "watersev
    Re: Compile error: Variable not defined

    hi jrpuig1977, it looks you have library reference missing. You can check that by VBE - Tools - References. In order for the code to work there should be a checked reference for "Microsoft Common Dialog Control 6.0 (SP6)". I suppose it is missing in your case. To correct that click VBE - Tools - References - Browse and locate file: comdlg32.ocx, select it and click OK. Now when this reference is checked no such error should appear.

    PS. Basically that is the question to the developer/s for the product support"

  11. #11
    Registered User
    Join Date
    10-16-2014
    Location
    Alberta
    MS-Off Ver
    2010
    Posts
    2

    Re: [SOLVED]Re: Compile error: Variable not defined

    This solution is not working for me, even after I correct the References as per "VBE - Tools - References - Browse and locate file: comdlg32.ocx, select it and click OK", I still get the Compile error: Variable not defined with CommonDialog highlighted...what can I try other than this.....I am not a VBA user so please help. I am using the same file referenced above in Excel 2010. Thanks.

  12. #12
    Registered User
    Join Date
    10-16-2014
    Location
    Alberta
    MS-Off Ver
    2010
    Posts
    2

    Re: Compile error: Variable not defined

    "The next step would be to change the frmPrompt form (and underlying code) to use the standard available Excel File/Folder dialogue (i.e. Application.FileDialog(msoFileDialogFilePicker)
    to select the file to be processed."

    OllieB, how do I do this?

+ 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