Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2014, 07:54 PM
smndnm smndnm is offline refering to the msoFileDialogueOpen variants Windows 7 64bit refering to the msoFileDialogueOpen variants Office 2010 64bit
Novice
refering to the msoFileDialogueOpen variants
 
Join Date: Jul 2014
Location: Queensland
Posts: 24
smndnm is on a distinguished road
Default Gracefully exiting the msoFileDialogFolderPicker

Hello,

This code currently does NOT exit gracefully when clicking cancel.



It causes a "Run time Error '5': invalid proedure call or argument."

I am thinking the problem occurs because there is no possible value to assign to 'Fldr', but then I also would have thought 'Exit Sub' meant Exit Sub now!!

Code:
 With Application.FileDialog(msoFileDialogFolderPicker)
    .InitialFileName = "G:\Admin - MASTER\Customers\"
    .AllowMultiSelect = False
    .Title = "Select Destination Folder for the SWMS"
    If .Show = -2 Then Exit Sub
    Fldr = .SelectedItems(1)
End With
any suggestions?

Regards from a brisk Queensland
Reply With Quote
  #2  
Old 07-19-2014, 10:12 PM
macropod's Avatar
macropod macropod is offline refering to the msoFileDialogueOpen variants Windows 7 32bit refering to the msoFileDialogueOpen variants Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As we've previously discussed, you could use the GetFolder function I've previously supplied and demonstrated...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-20-2014, 01:33 AM
smndnm smndnm is offline refering to the msoFileDialogueOpen variants Windows 7 64bit refering to the msoFileDialogueOpen variants Office 2010 64bit
Novice
refering to the msoFileDialogueOpen variants
 
Join Date: Jul 2014
Location: Queensland
Posts: 24
smndnm is on a distinguished road
Default

I really struggled with understanding the code you supplied. I couldn't work out how to preset the starting folder. Neither do I understand about Functions. (keeping in mind the whole project has been developed by semi-mindless fingers crossed copy paste and hope..)

I'll give it another shot though.

The code above presumes the user will select OK to continue. Would it work if the code presumes the user selects cancel and only explicitly continues on OK.
I am thinking something like:

If .Show = -1 then continue, Else End Sub. ( I am not sure how to write this correctly, I'll try again tomorrow)

Regards from Queensland
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Refering figure number too text danzi Word 1 01-20-2012 12:13 PM
Refering to photos on other pages woodfind Word 1 05-17-2010 01:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft