open a file (commondialog??)

I am trying to write a module in Access 2000, which really only should open a little window, like the one you use, when you open a file (as you do x times a day...) - and which should return a variable with the path name.
I've tried with different commanddialog functions, but I always get an error message saying 'object not found!.

What dim's, objects and commands do I need to use???

many thanx for any help!!!

Comments

  • : I am trying to write a module in Access 2000, which really only should open a little window, like the one you use, when you open a file (as you do x times a day...) - and which should return a variable with the path name.
    : I've tried with different commanddialog functions, but I always get an error message saying 'object not found!.
    :
    : What dim's, objects and commands do I need to use???
    :
    : many thanx for any help!!!
    :
    Hi, did you initialize the object correctly?
    Tools/References/Browse, select *.ocx files,
    choose WinDirSystem(32)Comdlg32.ocx

    When I tried just to check the Microsoft Common Dialog 6.0 (SP3) it didn't work.. (It told me invalid use of NEW keyword).. I don't know why

    [code]Option Compare Database

    Private cdbFile As MSComDlg.CommonDialog

    Sub SubShowOpen()
    Set cdbFile = New MSComDlg.CommonDialog

    cdbFile.Filter = "Text file *.txt|*.txt"
    cdbFile.ShowOpen
    MsgBox cdbFile.FileName
    End Sub[/code]

    And it should work

    PavlinII
  • : : I am trying to write a module in Access 2000, which really only should open a little window, like the one you use, when you open a file (as you do x times a day...) - and which should return a variable with the path name.
    : : I've tried with different commanddialog functions, but I always get an error message saying 'object not found!.
    : :
    : : What dim's, objects and commands do I need to use???
    : :
    : : many thanx for any help!!!
    : :
    : Hi, did you initialize the object correctly?
    : Tools/References/Browse, select *.ocx files,
    : choose WinDirSystem(32)Comdlg32.ocx
    :
    : When I tried just to check the Microsoft Common Dialog 6.0 (SP3) it didn't work.. (It told me invalid use of NEW keyword).. I don't know why
    :
    : [code]Option Compare Database
    :
    : Private cdbFile As MSComDlg.CommonDialog
    :
    : Sub SubShowOpen()
    : Set cdbFile = New MSComDlg.CommonDialog
    :
    : cdbFile.Filter = "Text file *.txt|*.txt"
    : cdbFile.ShowOpen
    : MsgBox cdbFile.FileName
    : End Sub[/code]
    :
    : And it should work
    :
    : PavlinII
    :

    You are trying the create a control with new. VB doesn't allow that!
    You are going to have to find another way! (There are API's, actually: The MSComDlg uses these API's!)

    Greets...
    Richard

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories