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-08-2004, 09:46
olympiatr
Guest
 
Posts: n/a
Default using "importfromfile" command without file name d

i need a use "importfromfile" command without describe file name. below the code you'll understand what i mean (i wanted to make use of some part of your file converter codes ;

Dim d As Document
Dim CurFileName As String, Ret As VbMsgBoxResult
Dim SourceDir As String
Dim n As Integer
Dim s As Shape
'************************************************

Set d = OpenDocument("C:\BILGI\sol.cdr") 'note to Alex:[this is template document for left page. it has inside aparagraph text!]
SourceDir = "C:\BILGI\FOLDERS\BILGISAYAR\FATMA ESRA AKALPOĞLU\"
For n = 65 To 90 ' note to Alex:[what will i write here for specify filename? when i write this code it can't browse for files in specifed 'folder]
CurFileName = SourceDir & chr(n) ' note to Alex:[if i write here like this:CurFileName = SourceDir & "1.rtf" it works great
'so i said, i need to use importfromfile command without a name description, it have to find just ".rtf" document cause inside the
'student folder just "1" rtf document ]
If Right$(SourceDir, 1) <> "\" Then SourceDir = SourceDir & "\"
If Right$(CurFileName, 4) = ".RTF" Then
Set s = d.ActiveLayer.FindShape(Type:=cdrTextShape)
If s.Text.Type = cdrParagraphText Then
s.Text.ImportFromFile CurFileName, 1, cdrParagraphIndexing
s.Text.Story.CharSet = cdrCharSetTurkish: s.Text.Story.LanguageID = cdrTurkish
s.Text.Story.Font = "Times New Roman": s.Text.Story.Italic = True
s.Text.Story.Alignment = cdrFullJustifyAlignment: s.Text.FitTextToFrame
s.Fill.UniformColor.CMYKAssign 0, 0, 0, 100
End If
End If
Next n
End Sub

if u help me for this i will be run easily over this project. cause i have 700 folders for make , we are makin yearbook for schools and every school has over 500 student. if u show me the way i will be run this for folder which has inside over 40 folders, i think i can do this cause i read and test all of your codes (for example: browse for folder, finding a file subfolders etc...) sorry it will be a long mail but i have to send these codes also you can examine, maybe you smile to those codes


Private Sub EKONOMISOL_Click()
Set d = OpenDocument("C:\BILGI\sol.cdr") 'left template page
Set impopt = New StructImportOptions: impopt.Mode = cdrImportFull
Set impflt = ActiveLayer.ImportEx("C:\BILGI\FOLDERS\EKONOMI\EDA AKKAYA\1.psd", cdrPSD, impopt)
impflt.Finish
Set s1 = ActiveShape: s1.AlignToPage cdrAlignLeft + cdrAlignTop, cdrTextAlignBoundingBox
Set impopt = New StructImportOptions: impopt.Mode = cdrImportFull
Set impflt = ActiveLayer.ImportEx("C:\BILGI\FOLDERS\EKONOMI\EDA AKKAYA\2.psd", cdrPSD, impopt)
impflt.Finish
Set s2 = ActiveShape
s2.AlignToShape cdrAlignTop, ActivePage.Layers("Layer 2").Shapes(1), cdrTextAlignBoundingBox
s2.AlignToShape cdrAlignRight, ActivePage.Layers("Layer 2").Shapes(2), cdrTextAlignBoundingBox
Set impflt = ActiveLayer.ImportEx("C:\BILGI\FOLDERS\EKONOMI\EDA AKKAYA\3.psd", cdrPSD, impopt)
impflt.Finish
Set s3 = ActiveShape
s3.AlignToShape cdrAlignVCenter, ActivePage.Layers("Layer 2").Shapes(3), cdrTextAlignBoundingBox
s3.AlignToShape cdrAlignRight, ActivePage.Layers("Layer 2").Shapes(4), cdrTextAlignBoundingBox
Set s = d.ActiveLayer.FindShape(Type:=cdrTextShape)
If s.Text.Type = cdrParagraphText Then
s.Text.ImportFromFile "C:\BILGI\FOLDERS\EKONOMI\EDA AKKAYA\EDA AKKAYA.rtf", 1, cdrParagraphIndexing
s.Text.Story.CharSet = cdrCharSetTurkish: s.Text.Story.LanguageID = cdrTurkish
s.Text.Story.Font = "Times New Roman": s.Text.Story.Italic = True
s.Text.Story.Alignment = cdrFullJustifyAlignment: s.Text.FitTextToFrame
s.Fill.UniformColor.CMYKAssign 0, 0, 0, 100
End If
Set rct = ActiveLayer.CreateRectangle(6.040898, 0.718575, 6.557528, 0.468504): rct.Fill.ApplyNoFill
rct.Outline.SetProperties 0.003, OutlineStyles(0), CreateCMYKColor(0, 100, 100, 0), ArrowHeads(0), ArrowHeads(0), False, False, cdrOutlineButtLineCaps, cdrOutlineMiterLineJoin, 0#, 100
rct.Outline.SetProperties 0#
With rct.Fill.ApplyTextureFill("Soft water", "Samples")
.SetProperties 4714, 60, 25, 95, CreateRGBColor(51, 102, 153), CreateRGBColor(219, 240, 240), 0
.TransformWithShape = True: .MirrorFill = False
.TileOffsetType = cdrTileOffsetRow: .TileOffset = 0: .RotationAngle = 0#
.SkewAngle = 0#: .TileWidth = 0.51663: .TileHeight = 0.250071
.OriginX = 0#: .OriginY = -0.250071: .MaximumTileWidth = 2049: .Resolution = 300: End With
With rct.Transparency.ApplyFountainTransparency(0, 100, cdrLinearFountainFill, -89.236102, 255, 17, 50)
.StartX = 6.27448: .StartY = 0.702087: .EndX = 6.277228: .EndY = 0.495984: End With
Set t = ActiveLayer.CreateArtisticText(0, 0, "10", cdrTurkish, , "Times New Roman", 11, cdrFalse, cdrFalse, , cdrCenterAlignment)
t.Fill.UniformColor.CMYKAssign 0, 0, 0, 100
t.AlignToShape cdrAlignHCenter, rct, cdrTextAlignBoundingBox: t.AlignToShape cdrAlignVCenter, rct, cdrTextAlignBoundingBox
ActivePage.Layers("Layer 2").Shapes.All.Delete
ActiveDocument.SaveAs ("C:\BILGI\FOLDERS\EKONOMI\EDA AKKAYA\10.cdr"): ActiveDocument.Close
Reply With Quote
  #2  
Old 02-08-2004, 09:48
olympiatr
Guest
 
Posts: n/a
Default test

test
Reply With Quote
  #3  
Old 13-08-2004, 13:12
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: test

Olympia,

I'm not sure I understand your problem correctly, but I guess you want to find out the file of an RTF file which is in a folder you know...

You should use VBA's Dir function to find files in a folder:

Code:
Dim FileName As String
Dim Path As String

Path = "C:\SomeFolder\"
FileName = Dir(Path & "*.rtf")
If FileName <> "" Then
    ' The file has been found, let's find it's full path...
    FileName = Path & FileName
    ' Now you can use FileName to import the text
Else
    ' No RTF files are found in this folder....
End If
I hope this helps.
Reply With Quote
  #4  
Old 14-08-2004, 03:39
olympiatr
Guest
 
Posts: n/a
Default Re: test

ok Alex, first of all thanks much for interesting. i am seeing you did not understand me correctly by your code; i can "import" a file like this, this is not problem. also i used some part of your "file converter" codes, it is workin great and i can find in a folder some .psd or etc.. files and importing them correctly. my problem is "importfromfile" command. if u try a import test.rtf (i am sending to you) inside test.cdr file's (also i am sending this one)paragraph text area with "importfromfle" command, you'll see it will say to you about error can you test it for me? many thanx Alex... nice day...
Attached Files
File Type: zip test.zip (11.0 KB, 789 views)
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
delete vba project from cdr file hotairballoon CorelDRAW/Corel DESIGNER VBA 1 18-05-2005 10:08
File Convertor to do transpararent TIFFs dan CorelDRAW/Corel DESIGNER VBA 8 22-12-2004 14:23
Finding a File in Sub Folders shelbym CorelDRAW/Corel DESIGNER VBA 10 10-05-2004 09:02
New macros: Oberon Selection Manager & File Name inserte Alex Site News 0 24-08-2003 13:28
Open - Resize - Savefile in Photo Paint greenee Corel Photo-Paint VBA 2 28-06-2003 04:54


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


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