Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Go Back  Xtreme Visual Basic Talk > > > Get Open File Dialog Box in Windows 7...old code broke


Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2012, 12:24 PM
VBAguy's Avatar
VBAguy VBAguy is offline
Centurion
 
Join Date: Feb 2005
Location: Kentucky (USA)
Posts: 186
Question Get Open File Dialog Box in Windows 7...old code broke


I wrote this code a while back and it's been working beautifully until I switched to Windows 7. This is just part of the code but it's the part that's broken right now and I'm getting an error message. I need to present an open file dialog box and allow the user to select the appropriate Excel file. Here's the current code:

Code:
Sub Open_File_Dialog
    Dim objDialog, intResult
    'Displays an open file dialog box and opens file selected
	Set objDialog = CreateObject("UserAccounts.CommonDialog")
	objDialog.Filter = "Excel Files (.xls)|*.xls"
	objDialog.FilterIndex = 1
	objDialog.InitialDir = "H:\Account Detail\"
	intResult = objDialog.ShowOpen
    
	If intResult = 0 Then
        Dim msg
        msg = "Must Select a File"
		MsgBox msg, vbinformation + vbcritical
        Set objDialog = Nothing
        Wscript.Quit
	Else
		ExcelFile = objDialog.FileName
	End If
    Set objDialog = Nothing
End Sub
I'm getting an error message on this line:

Code:
Set objDialog = CreateObject("UserAccounts.CommonDialog")
How would I update this to do the same thing in Windows 7? Thanks so much for the help. It's been a while since I've done this stuff so I'm not up to date at all.
__________________
There are some things that we will never know
And we will never know that we don't know them.
Reply With Quote
  #2  
Old 07-20-2012, 07:14 AM
DrPunk's Avatar
DrPunkGet Open File Dialog Box in Windows 7...old code broke DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

__________________
There are no computers in heaven!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
 
Get Open File Dialog Box in Windows 7...old code broke
Get Open File Dialog Box in Windows 7...old code broke
 
-->