OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 19-08-2005, 00:28
Posts: n/a
Default Execute Menu or Command Button item with VBA?

I don't know if I'm using the wrong refrences or what, but

Sub FileSave()
End Sub
doesn't work. I don't know Corel very well, but that would work in Office products.

Is there a Corel Equivalent? Not that I need to save, but if I understood how to make this work I'd be able to execute menu items that aren't readily available to Corel VBA.

Reply With Quote
Old 19-08-2005, 09:42
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4


No, you can't do that, but what you can do is send keystrokes to CorelDRAW. Sending Alt-F, S <b>should</b> be invoking the Save command if not for the fact that S mnemonic is shared between Close All and Save commands. But you still can send Alt-F, Down arrow 5 times, Enter to execute File>Save, for example.

Anyway, you need to use SendKeys command to do that. See VBA's online help on syntax and usage of it. You can also search for SendKeys here in the forum and you'll find quite a few posts on the subject. Here is one of them: http://forum.oberonplace.com/showthread.php?t=489

I hope this helps
Reply With Quote
Old 19-08-2005, 09:44
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

maybe the real possibility is to use sendmessage api (you must investigate what are the corel menu ids are)
Reply With Quote
Old 19-08-2005, 13:06
Posts: n/a

Thanks guys. I've used Sendmessage before, so that's where I started. But I was quickly overwhelmed and went with the way easier sendkeys.

The main thing I wanted was to incorporate the Arrange==Close Path==Closest Nodes with Straight Lines, with some other things (Line Width to none, uniform fill to Grey, rename object name to Grey) to make my clean up after a trace a little more streamlined.

So... I made the 'Closest Nodes with Straight Lines' command have a shortcut of CTRL-SHIFT-V (you can use whatever's free and strikes your fancy), so I wouldn't have to navigate the menu, then made a custom sub in the GlobalMacros module so I could easily make a custom button to run it from my command bar...

(OK, so I'm not that good at naming things, but it makes sense in my head...)

Sub MakeIntoShapeChangeFillColorAndObjectName()
  Dim OrigSelection As ShapeRange
  SendKeys "^+v"
  Set OrigSelection = ActiveSelectionRange
  ActiveSelection.ObjectDate("Name").Value = "Grey"
  OrigSelection.ApplyUniformFill CreateCMYKColor(0, 0, 0, 20)
  OrigSelection.SetOutlineProperties (0)
End Sub
There's probably an easier way, but at least it works for me now. I change the object name, because I'll use it later to easily iterate through and make changes to the properties without having to select on each one with the mouse. I also change the names to the other sets of objects in my picture.

Thanks for your help... I didn't want to have to use the subpath and node stuff when I knew just clicking on that menu item did exactly what I wanted. Why reinvent the wheel.

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
How can I add a new menu to the coreldraw by the VBA levin CorelDRAW/Corel DESIGNER VBA 15 17-07-2011 14:35
Where to begin with CorelDRAW and VBA shelbym CorelDRAW/Corel DESIGNER VBA 2 03-04-2007 09:15
delete vba project from cdr file hotairballoon CorelDRAW/Corel DESIGNER VBA 1 18-05-2005 09:08
CD 10, VBA not returning true outline width Webster CorelDRAW/Corel DESIGNER VBA 1 24-11-2004 17:09
Detect if VBA is installed (an answer and a question) reanan CorelDRAW/Corel DESIGNER VBA 3 04-12-2002 14:35

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

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