OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20-05-2015, 05:22
JacquesCHENU JacquesCHENU is offline
Junior Member
 
Join Date: Oct 2008
Posts: 12
Default VBA Import file

Need help....
Windows 8.1 CorelDRAW X6

I have a macro for opening file, filename is in .txt file.
I want replace Open by Import, filename always in .txt file.

Sub Import_via_ouverture_Fichier_txt_Altù()
'
' Recorded 29/04/2015
'
' Description:
' Ouverture Fichier jpg ou cdr à partir variable.txt
'
Dim impflt As ImportFilter
Dim impopt As StructImportOptions
Dim TextLine_1, TextLine_2
Dim fso As Object, ok, f, FichierData, NomFichier, doc1 As Document

Open "D:\ZZ Sauve JOUR\Document\SuperMacro\Sauve_variables\Scripts Corel\Retour Erreur Corel Ouvre Fichier.txt" For Output As #1
FichierData = "D:\ZZ Sauve JOUR\Document\SuperMacro\Sauve_variables\Scripts Corel\Fichier Ouvrir_Import.txt"
Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FileExists(FichierData) Then
Set f = fso.OpenTextFile(FichierData, 1)
NomFichier = f.ReadLine

If fso.FileExists(NomFichier) Then
Set doc1 = OpenDocument(NomFichier)
Print #1, "OK"
Close #1
f.Close

End If
End If
End Sub


Many thanks
Reply With Quote
  #2  
Old 20-05-2015, 09:14
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default

do you want open .txt file, read content and make a paragraph/artistic shape?
Reply With Quote
  #3  
Old 20-05-2015, 13:28
JacquesCHENU JacquesCHENU is offline
Junior Member
 
Join Date: Oct 2008
Posts: 12
Default VBA Import file

First line of .txt file is filename (path & filename .cdr or .jpeg or other image extension)
Importation of this file on current CorelDRAW Windows.
In fact is the same macro shows, but with IMPORT in place of OPEN.

I hope my explanations are clear because I don't speak english fluently.
Reply With Quote
  #4  
Old 20-05-2015, 14:58
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default

Try this:
Code:
If fso.FileExists(NomFichier) Then
dim s as shape
    ActiveLayer.Import NomFichier
    ' first (top) item must be = imported shape (group shape)
    Set s = ActiveLayer.TreeNode.Children(1).Shape
    MsgBox s.Name
    Refresh
end if
Reply With Quote
  #5  
Old 21-05-2015, 02:59
JacquesCHENU JacquesCHENU is offline
Junior Member
 
Join Date: Oct 2008
Posts: 12
Default

Hello

It's ok, but I cancel MsgBox, I don't need.

Many thanks....
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
Simple Import of file object dungbtl CorelDRAW/Corel DESIGNER VBA 6 09-04-2013 14:34
Export & Import Text Strings in .CDR file Shail CorelDRAW CS 6 29-03-2012 04:52
Import text file to create shapes jess916 Macros/Add-ons 3 12-08-2008 21: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 13:41
Import and ungroup PDF file medo321 CorelDRAW/Corel DESIGNER VBA 1 24-03-2004 10:04


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


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