Common dialog

Discussion in 'AutoCAD' started by Jon, Sep 30, 2004.

  1. Jon

    Jon Guest

    Hi all,

    I have a module that needs to get a filename, so I initiate a form with a
    common dialog. The CD starts fine, I get the filename, but I can't
    automatically close the form that the CD is on. What am I doing wrong?
    Here is what I am trying:

    Private Sub cd_gettemplate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    gettemplatefile.hide ' I thought this would close the form, but I was
    wrong.
    End Sub

    Private Sub UserForm_Initialize()
    cd_gettemplate.InitDir = templatedirectory
    cd_gettemplate.Filter = "TEM|*.TEM"
    cd_gettemplate.DialogTitle = "Select Template File"
    cd_gettemplate.ShowSave
    templatefilename = cd_gettemplate.FileName
    End Sub

    I have been learning VBA over the last week and would like to thank the
    following for their past contributions to the newsgroup which I have trawled
    for many other answers: (in alphabetical order)
    R. Robert Bell
    Laurie Comerford
    Frank Oquendo
    Lanny Schiele
    Joe Sutphin
    Tony Tanzillo
    and many others.

    Thanks

    Jon
     
    Jon, Sep 30, 2004
    #1
  2. Hi Jon,

    You've embarrassed me by listing me with the knowledgable here.

    However,

    The approach I would take would be to put an OK command in the form and read
    the file name at that time. On the OK_Click event the code can include

    "me.hide" to hide the form, or if you wish the OK to initiate your
    computations, you could do them and end the program with
    "Unload me"

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Sep 30, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.