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 26-12-2006, 05:00
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Invoking SaveAs Dialogue Box

Hello,

Is there any way to create a macro in CorelDraw 12 that will bring up the SaveAs Dialogue box? ActiveDocument.Save only brings up the dialogue box if the document has never been saved before and ActiveDocument.SaveAs returns an error unless I use a predetermined filename which defeats what I'm trying to do. I want to be able to choose the save location and file name and then run the rest of the macro.

Thanks,

Chris (Hunt)
Reply With Quote
  #2  
Old 26-12-2006, 08:04
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

put the "declare" statement in ordinary code module (necessary part), then make a call with parameters below
Code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd&, ByVal Msg&, ByVal wParam&, ByVal lParam&) As Long

Sub saveAss()
   SendMessage AppWindow.Handle, &H111, &H1E104, 0
   End Sub
Reply With Quote
  #3  
Old 26-12-2006, 17:27
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Thanks Os, that worked perfectly. I've now managed to replace the ordinary Save and SaveAs buttons so that Corel also saves a shortcut to the file at the same time. This means I can keep all the Corel files in alphabetical folders in one place and then have multiple shortcuts organised according to projects. I should be able to avoid making duplicate files that was my bad habit in the past.

You are a fantastic help. Best wishes,

Chris
Reply With Quote
  #4  
Old 02-01-2007, 07:30
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Chris, would you mind sharing this macro? I would love to see how it works.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #5  
Old 02-01-2007, 22:00
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Saving A shortcut when Saving A File

Hi, here is the macro, cobbled together from code posted to this forum, only potential errors are my own work, I'd welcome suggestions and improvements:

Code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd&, ByVal Msg&, ByVal wParam&, ByVal lParam&) As Long

Sub saveAss()

    If ActiveDocument Is Nothing Then
        MsgBox "There is no document open", vbCritical
        Exit Sub
    End If


   SendMessage AppWindow.Handle, &H111, &H1E104, 0
   
   
    If ActiveDocument.FullFileName = "" Then
    Exit Sub
    End If

    LNKFile = "E:\ZZ Shortcuts\Corel" & Chr(92) & ActiveDocument.FileName & ".lnk"
    CreateLNKFile LNKFile, ActiveDocument.FullFileName
      
   End Sub


Private Sub CreateLNKFile(ByVal sShortcut As String, ByVal sFileLinkName As String)
    Dim Sh As Object
    Dim link As Object
    
    Set Sh = CreateObject("WScript.Shell")
    Set link = Sh.CreateShortcut(sShortcut)
    link.TargetPath = sFileLinkName
    link.Description = "Shortcut for CorelDRAW document"
    link.IconLocation = "C:\Z modifications\_Essential\corelball.ico, 0"
    link.Save
End Sub
To activate this Macro I reassigned the keyboard shortcut ctrl+shift+s. As far as I can tell it overwrites the existing shortcut each time so if I make a duplicate file with the same name in another location I overwrite the shortcut to the original file. But since I'm saving files in alphabetical folders I shouldn't have duplicate filenames.

I have a similar macro for save, I reassigned the keyboard shortcut ctrl+s and also replaced the original save button with one that activates the macro. I also have another button that brings up a dialogue box that allows me to assign multiple shortcuts to specific folders at the same time. I store the shortcuts on one partition and the actual files on another.

The line:
Code:
link.IconLocation = "C:\Z modifications\_Essential\corelball.ico, 0"
Ensures that my shortcut uses the same icon. I'm still using the old balloon icon as I prefer it.

All the best,

Chris
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
X3 and print dialogue box jkendo General 9 13-07-2006 09:09
Lost Completion Dialogue Box knowbodynow CorelDRAW/Corel DESIGNER VBA 3 10-07-2006 09:37
Open File Dialogue box won't sort - v11.0 Anonymous General 0 12-01-2005 19:09
SaveAs Method throwing an in consistent error wbochar CorelDRAW/Corel DESIGNER VBA 1 20-03-2003 14:37
SaveAs function not working in PP11 Aneurysm Corel Photo-Paint VBA 2 03-03-2003 17:31


All times are GMT -5. The time now is 16:41.


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