OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 21-02-2010, 21:09
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default creating folder if folder doesn't exist

Hi.
I'm creating a folder if a folder doesn't exist and resuming macro. It seems to work fine on my machine but having trouble on other users machine and not sure why. It goes to line 005 (see code).

Here's a chunk of code clipped. Any ideas, suggestions, or better approach would be appreciated.

Code:
saveFold = frmMain.txtPath.Value

    
    If CorelScriptTools.FileAttr(saveFold) = 16 Then
        'do nothing
    Else
        Dim answ1 As Integer
        answ1 = MsgBox("Folder does not exist. Would you like to create it?", vbOKCancel)
        If answ1 = vbOK Then
            'create folder and continue
            Dim foldNew As String
            If CorelScriptTools.MkFolder(saveFold) Then
                'do nothing and continue with sub
                frmMain.txtPath.Value = frmMain.txtPath.Value & "\" 'add backslash.
                If Right(frmMain.txtPath.Value, 2) = "\\" Then
                    frmMain.txtPath.Value = Left(frmMain.txtPath.Value, Len(frmMain.txtPath.Value) - 1) ' remove double backslash
                End If
                saveFold = frmMain.txtPath.Value
            Else
'error 005
                MsgBox "Unable to create folder. Please check path and User Permissions", vbCritical
            End If
        ElseIf answ1 = vbCancel Then
            'exit sub
            Exit Sub
        Else
            'exit sub
            Exit Sub
        End If
    End If
    
    
    SaveSetting "myMacro", "Preferences", "path", frmMain.txtPath.Value
Thanks,
John
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder Check norbert_ds CorelDRAW/Corel DESIGNER VBA 2 13-01-2008 20:18
Browse for folder ddonnahoe CorelDRAW/Corel DESIGNER VBA 2 09-11-2005 17:44
List names of files located in a folder RVogel CorelDRAW/Corel DESIGNER VBA 1 31-03-2005 16:14
Browse for Folder shelbym CorelDRAW/Corel DESIGNER VBA 2 12-04-2004 17:13
Creating New Folder Haucer Corel Photo-Paint CS 1 23-10-2003 07:22


All times are GMT -5. The time now is 06:58.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com