Open Folder code not working after technical upgrade

Gary_J
Member Posts: 12
Hi all,
Doing some testing on a technical upgrade from 3.60 to 2009, have found one bit of code that doesn't work. On several forms I've added a button to open a folder from a directory on the server (or create it if it doesn't exist), the code came from these forums although I've tweaked it a bit:
The globals are:
FileSystem / Automation / 'Microsoft Scripting Runtime'.FileSystemObject
FolderName / Text / 50
The only bit that doesn't work is the part where it opens the folder, each time it tries the system displays the following error:
The operating system cannot find the drive and directory that are specified for the file "c:\windows\explorer.exe \\rocdc01\sales\ac_files\AC07694" .
Verify that the drive, directory, and file names are correct.
Any help appreciated!
Doing some testing on a technical upgrade from 3.60 to 2009, have found one bit of code that doesn't work. On several forms I've added a button to open a folder from a directory on the server (or create it if it doesn't exist), the code came from these forums although I've tweaked it a bit:
FolderName := "No."; IF ISCLEAR(FileSystem) THEN CREATE(FileSystem); // If the folder exists, open it IF FileSystem.FolderExists('\\rocdc01\sales\ac_files\'+FolderName) THEN SHELL('c:\windows\explorer.exe \\rocdc01\sales\ac_files\'+FolderName); // If the folder doesn't exist, ask if you want to create it then open the folder IF NOT FileSystem.FolderExists('\\rocdc01\sales\ac_files\'+FolderName) THEN IF NOT CONFIRM('The folder does not exist. Do you want to create it?') THEN EXIT ELSE FileSystem.CreateFolder('\\rocdc01\sales\ac_files\'+FolderName); SHELL('c:\windows\explorer.exe \\rocdc01\sales\ac_files\'+FolderName);
The globals are:
FileSystem / Automation / 'Microsoft Scripting Runtime'.FileSystemObject
FolderName / Text / 50
The only bit that doesn't work is the part where it opens the folder, each time it tries the system displays the following error:
The operating system cannot find the drive and directory that are specified for the file "c:\windows\explorer.exe \\rocdc01\sales\ac_files\AC07694" .
Verify that the drive, directory, and file names are correct.
Any help appreciated!
0
Comments
-
Hi!
you can try to use
//WshShell Automation 'Windows Script Host Object Model'.WshShell
//Myfolder text --> path of your folder
Envir :='%windir%\explorer.exe';
WshShell.Exec(Envir+MyFolder);0 -
Thank you, using WshShell was just what I needed!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions