Subject:Problems creating folder
Posted by: Kit
Date:6/4/2011 12:11:14 AM
The following code saves named regions to a folder selected by the user. The problem is if the user makes a new folder it creates the folder but doesn't save the files. When the flder exists the files are saved. What is wrong? Thanks. Kit
|
Subject:RE: Problems creating folder
Reply by: roblesinge
Date:6/5/2011 11:40:29 AM
This seems like a really complicated way to do what you're describing. Let me make sure I understand what you're trying to accomplish. You want to take only named regions in a file (meaning there are unnamed regions you want to skip) and have them saved as separate files in a folder selected by the user? Or are all the regions named and you want them saved by those region names as separate files in a selected folder? Rob. |
Subject:RE: Problems creating folder
Reply by: Kit
Date:6/5/2011 5:41:28 PM
Thanks for the reply. I want to be able to save any regions highlighted by the user. I want the user to have the option to save to any chosen folder. If no region is highlighted I want to offer the user the option to save all regions to a chosen folder. I want to be able to save the path to the last used folder so that it becomes the default folder for next time the macro is run. My problem is that the code won't save the names if the regions if a new folder is created meaning that the user has to run the macro twice if a new folder is created. Kit |
Subject:RE: Problems creating folder
Reply by: roblesinge
Date:6/7/2011 3:30:56 PM
I think the ChooseDirectory method will allow the user to create a new folder. I don't see why you need to have the code that follows that call. The directory is either there or it isn't. If you're worried about a null result from that call, you can put it in a loop until the user gives you a valid file path. Try commenting out that section and see if this solves your problem. Rob. |
Subject:RE: Problems creating folder
Reply by: Kit
Date:6/8/2011 5:42:55 PM
Not sure what you mean - I tried commenting out some lines but still had problems. I decided to rebuild the script using the example SaveRegionsAsFiles.cs from the SDK. I think I have what I need now. Thanks for your help. Kit |