OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20-11-2016, 08:02
FaneDuru FaneDuru is offline
Member
 
Join Date: May 2012
Posts: 35
Question ExportBitmap with not rewrite file

Is it a way in case of ExportBitmap automation to receive a warning in case of a file with the same name already exists?

I mean for the next piece of code is it a way to stop export in case that a file with the same name already exists in the export folder...
Code:
Set Filter = d.ExportBitmap(strFile, cdrJPEG, cdrCurrentPage, _
    cdrRGBColorImage, 1000, 1000, 300, 300)
  With Filter
    .Compression = 80
    .Optimized = True
    .Smoothing = 10
    .SubFormat = 1
    .Progressive = False
    .Finish 'is there a way to stop this part for the same file name in export location folder...
  End With
Reply With Quote
  #2  
Old 21-11-2016, 00:38
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 145
Default

you can use the standard function FileAttr to see whether a file exists:

Code:
If CorelScriptTools.FileAttr(strFile) <> 0 Then
    If MsgBox("Rewrite " + strFile + " ?", vbYesNo + vbQuestion, _
            "File exist") = vbNo Then
         ' set new name for strFile
    else
         ' rewrite file
    end if
end if

'your code...
Set Filter = d.ExportBitmap(strFile, cdrJPEG, cdrCurrentPage, _
      cdrRGBColorImage, 1000, 1000, 300, 300)
Reply With Quote
  #3  
Old 21-11-2016, 14:33
FaneDuru FaneDuru is offline
Member
 
Join Date: May 2012
Posts: 35
Default

Thanks!
I found a similar workaround:
Code:
Inceput:
'Code using GetFileBox to select the name but seeing the pictures there, returning strFile...

Director = Left(strFile, InStrRev(strFile, "\"))
NumeDublu = Right(strFile, Len(strFile) - InStrRev(strFile, "\"))
  
  Fisier = Dir$(Director)
  Do While Len(Fisier) <> 0
    Fisier = Dir$: If Fisier = NumeDublu Then GoTo Nasol
  Loop
  Filter.Finish 

  'Some other code here...

   GoTo Sfarsit
Nasol:
  Dim Rasp As VbMsgBoxResult
   Rasp = MsgBox("The file named """ & NumeDublu & """ already exists in the export location." & vbCrLf & _
                 "  Would you like to rewrite it?" & vbCrLf & vbCrLf & _
                 "  If yes, please choose ""Yes""..." & vbCrLf & _
                 "  For renaming choose ""Cancel"".", vbYesNoCancel, "Existing name")
        If Rasp = vbYes Then
            Filter.Finish

            'some code here...

            GoTo Sfarsit
        End If
        If Rasp = vbCancel Then GoTo Inceput
Sfarsit:
Reply With Quote
Reply


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
Pdf Export Files Just Rewrite Over And Over sifterbox CorelDRAW/Corel DESIGNER VBA 10 13-12-2011 07:58
How to Bring up Convert to Bitmap dialog when using ExportBitmap abdoj CorelDRAW/Corel DESIGNER VBA 0 17-05-2010 11:51
C++Builder6 ExportBitmap pasha01 CorelDRAW/Corel DESIGNER VBA 0 06-12-2009 13:08
CorelDRAW 12 ExportBitmap MrClark CorelDRAW/Corel DESIGNER VBA 3 14-09-2005 15:15
alex!why don't you rewrite you secridesign? lees CorelDRAW/Corel DESIGNER VBA 0 18-06-2004 09:46


All times are GMT -5. The time now is 04:29.


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