?
Solved

Problem selecting folder in Visual Basic

Posted on 2003-03-25
5
Medium Priority
?
138 Views
Last Modified: 2013-11-25
Hi!, I´m trying to select a folder using FolderItem object with this code:

    Dim myShell As New Shell
    Dim FoldItem As FolderItem
    Dim l1 As Long
    Dim l2 As Long
    Set FoldItem = myShell.BrowseForFolder(l1, "Select Folder", l2)
   
    TextDirOrigen = FoldItem.Path   'Just to show the folder path



The problem is when I execute the program and I select the folder the error message is:
"types doesn´t match"
0
Comment
Question by:saller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Author Comment

by:saller
ID: 8204935
Is urgent...
0
 
LVL 14

Accepted Solution

by:
aelatik earned 300 total points
ID: 8205110
Dim a As New Shell
 Dim f As Folder
 Dim fi As FolderItem
 Set f = a.BrowseForFolder(Me.hWnd, "Browse", 0)
 Set fi = f.Items.Item
 MsgBox fi.Path
0
 
LVL 3

Expert Comment

by:emadat
ID: 8205115
Dim myShell As New Shell
Dim objFolder As Folder
Dim objFolderItem As FolderItem
Dim TextDirOrigen
    Set objFolder = myShell.BrowseForFolder(Me.hWnd, "Select Folder", 0)
    Set objFolderItem = objFolder.Items.Item(0)
    TextDirOrigen = objFolderItem.Path   'Just to show the folder path
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8205128
In your case this would be...

   Dim myShell As New Shell
   Dim Fold As Folder
   Dim FoldItem As FolderItem
   Dim l1 As Long
   Dim l2 As Long
   Set Fold = myShell.BrowseForFolder(Me.hWnd, "Select Folder", l2)
   Set FoldItem = Fold.Items.Item
   TextDirOrigen = FoldItem.Path   'Just to show the folder path
0
 

Author Comment

by:saller
ID: 8208961
Solved!!!!!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question