Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

File Open Dialog under Win 7

Hi Experts,

I know that Set objDialog = CreateObject("UserAccounts.CommonDialog") no longer works under Win 7, so I came up with:

    If XPmode = True Then
    
        Set objDialog = CreateObject("UserAccounts.CommonDialog")
        objDialog.Filter = "Bank Downloaded Files (*.xls)|*.xls"
        objDialog.FilterIndex = 1
        objDialog.InitialDir = startupFolder
        inFile = objDialog.ShowOpen
        Set objDialog = Nothing
        
    Else

        Set objDialog = CreateObject("MSComDlg.CommonDialog")
        objDialog.Filter = "Bank Downloaded Files (*.xls)|*.xls"
        objDialog.InitDir = startupFolder
        x = objDialog.ShowOpen()
        inFile = objDialog.FileName
        
    End If

Open in new window


When I run this under Win 7 using VB6 it works, but when I convert it to .vbs and run it on the same machine, I get ActiveX can't create object: 'MSComDlg.CommonDialog'

I also downloaded an ran regsvr32 on both comdlg32.dll (failed) and comdlg32.ocx (passed)

What do I do?
ASKER CERTIFIED SOLUTION
Avatar of Kent Dyer
Kent Dyer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial