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 02-03-2013, 05:30
dungbtl's Avatar
dungbtl dungbtl is offline
Senior Member
 
Join Date: Apr 2004
Posts: 155
Default Simple Import of file object

Looking for a piece code that imports an object file.
this works but puts it where it originates:

Code:
Sub importgrommet()
ActiveLayer.Import "C:\@_Drop\pins.cdr"
End Sub
Instead of placing this object on page
Im looking to have it act like when you IMPORT and object.
The object is with the mouse and you get the choice where to place it.
You click and it drops in place. Not where it originally was made from.
Then i would assign a shortcut for it when needed.

Working with X4

Thanks All
Reply With Quote
  #2  
Old 02-03-2013, 06:08
AVP AVP is offline
Junior Member
 
Join Date: May 2009
Posts: 13
Default Simple Import of file object

try this

Code:
Sub importgrommet()
 On Error GoTo myerr
    ActiveDocument.ReferencePoint = cdrCenter
    Dim x As Double, y As Double
    Dim Shift As Long
    b = False
    b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorWinCross)
    Optimization = True
    ActiveDocument.BeginCommandGroup "import"
    ActiveLayer.Import "C:\@_Drop\pins.cdr"
    ActiveShape.SetPosition x, y
myerr:
    ActiveDocument.EndCommandGroup
    Optimization = False
    ActiveWindow.Refresh
End Sub
Reply With Quote
  #3  
Old 02-03-2013, 06:18
dungbtl's Avatar
dungbtl dungbtl is offline
Senior Member
 
Join Date: Apr 2004
Posts: 155
Default

Seem to get a compile error. I found another post a while back...

Importing to "mouse click position"

I dont know what happens as I get errors. Seems like what im after.

But hopefully your code will do it

Quote:
Originally Posted by AVP View Post
try this

Code:
Sub importgrommet()
 On Error GoTo myerr
    ActiveDocument.ReferencePoint = cdrCenter
    Dim x As Double, y As Double
    Dim Shift As Long
    b = False   <---  Compile Error:  Can't find project or library 
    b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorWinCross)
    Optimization = True
    ActiveDocument.BeginCommandGroup "import"
    ActiveLayer.Import "C:\@_Drop\pins.cdr"
    ActiveShape.SetPosition x, y
myerr:
    ActiveDocument.EndCommandGroup
    Optimization = False
    ActiveWindow.Refresh
End Sub
Thanks !

Last edited by dungbtl; 02-03-2013 at 06:25.
Reply With Quote
  #4  
Old 02-03-2013, 06:40
AVP AVP is offline
Junior Member
 
Join Date: May 2009
Posts: 13
Default

Code:
Sub importgrommet()
 On Error GoTo myerr
    ActiveDocument.ReferencePoint = cdrCenter
    Dim x As Double, y As Double, Shift As Long, b As Boolean
    b = False
    b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorWinCross)
    Optimization = True
    ActiveDocument.BeginCommandGroup "import"
    ActiveLayer.Import "C:\@_Drop\pins.cdr"
    ActiveShape.SetPosition x, y
myerr:
    ActiveDocument.EndCommandGroup
    Optimization = False
    ActiveWindow.Refresh
End Sub
Reply With Quote
  #5  
Old 02-03-2013, 06:49
dungbtl's Avatar
dungbtl dungbtl is offline
Senior Member
 
Join Date: Apr 2004
Posts: 155
Default

PERFECT!
Made me day ...

Donuts and coffee down in the VIP room

Tell em Dungbtl sent ya
Reply With Quote
  #6  
Old 13-03-2013, 09:00
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default

Quote:
Originally Posted by dungbtl View Post
Looking for a piece code that imports an object file.
this works but puts it where it originates:

Code:
Sub importgrommet()
ActiveLayer.Import "C:\@_Drop\pins.cdr"
End Sub
Instead of placing this object on page
Im looking to have it act like when you IMPORT and object.
The object is with the mouse and you get the choice where to place it.
You click and it drops in place. Not where it originally was made from.
Then i would assign a shortcut for it when needed.

Thanks All
Shelby turned me on this...

Code:
Sub TestInteractiveImport()
    ActiveDocument.InteractiveImport "C:\@_Drop\pins.cdr"
End Sub

Last edited by SteveDude; 13-03-2013 at 14:52.
Reply With Quote
  #7  
Old 09-04-2013, 13:34
dungbtl's Avatar
dungbtl dungbtl is offline
Senior Member
 
Join Date: Apr 2004
Posts: 155
Default

Thanks Steve...

Im sure it works great for X6

im in X4 & 5

any chance for a cleaner code for that?

Reply With Quote
Reply

Tags
import, mouse, mouse click, object, user click


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
Export & Import Text Strings in .CDR file Shail CorelDRAW CS 6 29-03-2012 03:52
Import text file to create shapes jess916 Macros/Add-ons 3 12-08-2008 20:21
How to import values from a file, replace text,save file for each value with new name amaart CorelDRAW/Corel DESIGNER VBA 1 28-09-2007 12:41
Import SVG File to Separate Pages on Document Load Jadus CorelDRAW/Corel DESIGNER VBA 5 30-06-2005 12:56
Import and ungroup PDF file medo321 CorelDRAW/Corel DESIGNER VBA 1 24-03-2004 09:04


All times are GMT -5. The time now is 07:09.


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