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 29-05-2008, 10:12
ProofingGuy
Guest
 
Posts: n/a
Default Advance Save As Pdf Macro Help

So I want to to publish a pdf and have the name as the corel document.



This is the line that needs tweaked because I dont want every file to be saved as 'River Valley Holdings.pdf' for obvious reasons.

What code would I put in there to make it save as the cdr file name?

Also I need some sort of IF THEN statement that will save over the pdf if I've made changes to the corel file and need to save a new pdf. Any ideas?

Code:
Sub publishpdfR()
    ' Recorded 5/29/2008
    '
    ' Description:
    '     Publish to PDF.  R
    With ActiveDocument.PDFSettings
    '  SETTING GO HERE
    End With
    ActiveDocument.PublishToPDF "Z:\GRAPHICS\Proofs\R\River Valley Holdings.pdf"
End Sub

Last edited by ProofingGuy; 30-05-2008 at 12:09.
Reply With Quote
  #2  
Old 29-05-2008, 21:29
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Here is how you do it:

Code:
Sub TestPublish()
    Dim nPos As Long
    Dim strName As String
    
    With ActiveDocument.PDFSettings
        '--------------------------
        ' Specify PDF settings here
        '--------------------------
    End With
    
    strName = ActiveDocument.FileName
    nPos = InStrRev(strName, ".")
    If nPos > 0 Then strName = Left(strName, nPos - 1)
    strName = ActiveDocument.FilePath & strName & ".pdf"
    ActiveDocument.PublishToPDF strName
End Sub
Reply With Quote
  #3  
Old 30-05-2008, 10:37
ProofingGuy
Guest
 
Posts: n/a
Default

i need to have this set up so it reads the first letter of the filename and puts it in a folder assigned to that letter. so if the name is "AT&T" then it needs to be put into a folder specified for "A", for the example lets say it's in
C:\Proofs\A\

There will be ones that start with a number and need those to go into a folder called
c:\Proofs\Numbers\

It will be a long sequence for every letter in the alphabet but if I get the "A" and the numbers started I can do the rest.

thanks for the help so far.

Last edited by ProofingGuy; 04-06-2008 at 14:32.
Reply With Quote
  #4  
Old 04-06-2008, 14:32
ProofingGuy
Guest
 
Posts: n/a
Default

bump, and help would be great on this.
Reply With Quote
  #5  
Old 04-06-2008, 17:59
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Here is the changed code:

Code:
Sub TestPublish()
    Dim nPos As Long
    Dim strName As String
    Dim strSubFolder As String
    
    With ActiveDocument.PDFSettings
        '--------------------------
        ' Specify PDF settings here
        '--------------------------
    End With
    
    strName = ActiveDocument.Title
    nPos = InStrRev(strName, ".")
    If nPos > 0 Then strName = Left(strName, nPos - 1)
    strSubFolder = UCase(Left(strName, 1))
    If strSubFolder < "A" Or strSubFolder > "Z" Then
        strSubFolder = "Numbers"
    End If
    strName = "C:\Proofs\" & strSubFolder & "\" & strName & ".pdf"
    ActiveDocument.PublishToPDF strName
End Sub
Reply With Quote
  #6  
Old 05-06-2008, 10:24
ProofingGuy
Guest
 
Posts: n/a
Default

oh wow, i thought i was going to have to write a long sequence for each letter. thanks so much alex this macro is already a life saver for me. thanks a lot
Reply With Quote
  #7  
Old 11-06-2008, 16:02
ProofingGuy
Guest
 
Posts: n/a
Default

this macro has been working greatly. one more addition

when this is saved as pdf I have to attach it in a program that allows customers to view it, but i have to browse through and what not to attach it. is there a way for this macro to store the file location string so all i have to do is hit CTR + V to paste the link? what's that called, clipboard or whatever?
Reply With Quote
  #8  
Old 11-06-2008, 18:01
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
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 can do something like this:
Code:
Sub TestingClipboard()
    Set MyData = New DataObject
    
    MyData.SetText "C:\Proofs\" & strSubFolder & "\" & strName & ".pdf"
    MyData.PutInClipboard
End Sub
Might be a good idea to test if data is already on the clipboard, but that should get you started.

-Shelby
Reply With Quote
  #9  
Old 12-06-2008, 10:15
ProofingGuy
Guest
 
Posts: n/a
Default

thanks shelby. i had to use this for whatever reason.


Code:
    Set MyData = New DataObject
    
    MyData.SetText strName

Last edited by ProofingGuy; 12-06-2008 at 11:09.
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
Urgent: Coreldraw 3x: how to export all the pages in .CDR file into one .SVG file balan CorelDRAW/Corel DESIGNER VBA 1 21-05-2008 08:47
how to save multiple pages in coreldraw 12 OR how to save quality eps for animation kickingandscreaming General 2 19-08-2007 23:28
bad saved coreldraw file versin JSB CorelDRAW CS 0 19-06-2005 12:45
CorelDraw 8 error in DLL file - help !!! cannot open!!! Anonymous General 4 31-10-2004 16:52
Preview from CorelDRAW file and/or worksheet reanan CorelDRAW/Corel DESIGNER VBA 5 15-05-2003 19:29


All times are GMT -5. The time now is 23:46.


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