Results 1 to 6 of 6
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Debug,Compile within VBE (Office97/SR2)

    Has anyone ever found a way to compile a project from within project code?

    Issuing the VBE "Debug, Compile" seems to me to be little more than a syntax check - old-timers will remember pre-processing a source deck.

    It ought (but I know it might not) to be possible to have a simple macro that issued a Debug, Compile on the active project, ideally test the boolean result (errors or no-errors), and effect a File,Save according to the result.

    I've explored various items in this string in both PPT/VBE (where I want to be) and in Word/VBE (which always seems to be most helpful in offering up hints), with little success to date.

    <pre>Application.VBE.ActiveVBProject.VBComponent s.
    </pre>


    For the life of me I can't dream up a good reason NOT to be allowed to do it (beyond that the MS crew thought it wasn't reasonable). I can generate source code within modules. I ought to be able to check the syntax.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Debug,Compile within VBE (Office97/SR2)

    Well,

    Sub CompMe()
    VBE.ActiveVBProject.MakeCompiledFile
    End Sub

    returns a run-time error, and the Office VBE isn't up to the task anyway (except perhaps Developer Edition).

    Have you tried, ahem, SendKeys?

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Debug,Compile within VBE (Office97/SR2)

    > Have you tried, ahem, SendKeys?

    Yes, about seven years ago. You want me to try again? (grin!).

    I'm not expecting it to be at all possible. It is just the sort of thing that the development tean, junior edition, would disallow on the grounds that they couldn't find a use for it, so why should they put it in.

    I will have a shot at Sendkeys, again. although I feel that it won't satisfy my desire to do a FileSave conditional on a clean compile.

    Thanks Jefferson

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Debug,Compile within VBE (Office97/SR2)

    ... and while trying to do a SaveAs (PPA) tonight I got the attached message(s).

  5. #5
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Debug,Compile within VBE (Office97/SR2)

    A vague, distant bell is ringing here.

    I used to do this with Excel to 'pre-compile' all of the module sheets in an application.

    Create a function CompileAllSheets.

    On each sheet put an empty code stub e.g.
    Sub CompileSheet1()
    End Sub

    Call all of the code stubs from CompileAllSheets.

    Apparently Excel only compiles the sheet when some code is run on that sheet.
    Whether the compiling of the VBA code is the same in other versions of Office I don't know. (I know it has changed through the different Access versions)
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Debug,Compile within VBE (Office97/SR2)

    > A vague, distant bell is ringing here

    Steve, ask not for whom the bell compiles ..... THANKS

    <pre>Sub CompileAll()
    Call CompileDPNE
    Call CompileMAIN
    Call CompileSrt
    Call CompileUCon
    Call CompileUGeneral
    Call CompileUtils
    End Sub
    </pre>


    This code runs in PPT97(SR2).

    I'll try to find a way of looping through all modules of a project (probably borrowing code from my Word/VBA stuff) to avoid hard-coding the names. Then all I need to do is detect the compile errors, possibly with the "On Error".

Posting Permissions

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