OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-07-2008, 08:28
cristov
Guest
 
Posts: n/a
Default Where and how to define the save directory?!

Hello there,

I have the following ExportFilter and want to customize it with a fix place (Z:/artwork for../) for saving it. I`am a real VBA rookie and I think it would be no problem for some of you...

thanks for help in advance

--cristov

Dim fltJPEG As ExportFilter
Dim strBaseFileName As String
Dim nPos As Integer


If ActiveDocument.FileName = "" Then
MsgBox "Die Datei wurde bisher noch nicht gespeichert!", vbCritical
Exit Sub
End If

strBaseFileName = ActiveDocument.FileName
nPos = InStrRev(strBaseFileName, ".")
If nPos Then strBaseFileName = Left$(strBaseFileName, nPos - 1)


' Export to JPEG
Set fltJPEG = ActiveDocument.ExportBitmap(strBaseFileName & ".jpeg", cdrJPEG, cdrCurrentPage, _
ResolutionX:=72, ResolutionY:=72, _
AntiAliasingType:=cdrNormalAntiAliasing, _
UseColorProfile:=True)
With fltJPEG
.Progressive = False
.Optimized = True
.SubFormat = 0
.Compression = 0
.Smoothing = 0
End With
fltJPEG.Finish
Reply With Quote
  #2  
Old 09-07-2008, 12:37
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,787
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Try this....

You just need to add the path....like this.
Code:
Sub ExportToJPEG()
    Const ExportFolder As String = "Z:\artwork\"
    Dim fltJPEG As ExportFilter
    Dim strBaseFileName As String
    Dim nPos As Integer
    
    
    If ActiveDocument.FileName = "" Then
        MsgBox "Die Datei wurde bisher noch nicht gespeichert!", vbCritical
        Exit Sub
    End If
    
    strBaseFileName = ActiveDocument.FileName
    nPos = InStrRev(strBaseFileName, ".")
    If nPos Then strBaseFileName = Left$(strBaseFileName, nPos - 1)
    
    
    ' Export to JPEG
    Set fltJPEG = ActiveDocument.ExportBitmap(ExportFolder & strBaseFileName & ".jpeg", cdrJPEG, cdrCurrentPage, _
    ResolutionX:=72, ResolutionY:=72, _
    AntiAliasingType:=cdrNormalAntiAliasing, _
    UseColorProfile:=True)
    With fltJPEG
        .Progressive = False
        .Optimized = True
        .SubFormat = 0
        .Compression = 0
        .Smoothing = 0
    End With
    fltJPEG.Finish
End Sub
Good luck and happy scripting!

-Shelby
Reply With Quote
  #3  
Old 09-07-2008, 18:09
dungbtl
Guest
 
Posts: n/a
Default

Hey thats neat.....

any chance for a selective directory or active directory to save it in??

Sometimes we have to go into different customer folders and need to export a jpg back into their folder. It's a manual process doing so. Anyways, can vba realize that to export it back into that folder that you opened the file from?

Does this make sense?

Because when you want to open a file, Corel opens up where you last opened a file from.

Reply With Quote
  #4  
Old 09-07-2008, 19:27
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,787
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Well maybe...

Quote:
...export it back into that folder that you opened the file from
Not sure I understand this 100% but this code will save the JPEG back to folder the open file is saved in.
Code:
Sub ExportToJPEG()
    Dim fltJPEG As ExportFilter
    Dim strFileNameandPath As String
    Dim nPos As Integer
    
    If ActiveDocument.FullFileName = "" Then
        MsgBox "Current document is not saved yet"
        Exit Sub
    End If
    
    strFileNameandPath = ActiveDocument.FullFileName
    nPos = InStrRev(strFileNameandPath, ".")
    If nPos Then strFileNameandPath = Left$(strFileNameandPath, nPos - 1)
    
    ' Export to JPEG
    Set fltJPEG = ActiveDocument.ExportBitmap(strFileNameandPath & ".jpg", cdrJPEG, cdrCurrentPage, _
    ResolutionX:=72, ResolutionY:=72, _
    AntiAliasingType:=cdrNormalAntiAliasing, _
    UseColorProfile:=True)
    With fltJPEG
        .Progressive = False
        .Optimized = True
        .SubFormat = 0
        .Compression = 0
        .Smoothing = 0
    End With
    fltJPEG.Finish
End Sub
Let me know if I got it wrong...

-Shelby
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
Stop Save bprice CorelDRAW/Corel DESIGNER VBA 0 25-06-2008 06:29
how to save multiple pages in coreldraw 12 OR how to save quality eps for animation kickingandscreaming General 2 19-08-2007 22:28
script to save configuration sazy General 5 06-08-2007 07:15
how do i define a save location? cristov CorelDRAW/Corel DESIGNER VBA 4 28-10-2005 20:03
2dimensional-array of directory-names Seelenquell CorelDRAW/Corel DESIGNER VBA 3 02-02-2004 11:23


All times are GMT -5. The time now is 17:22.


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