OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old 26-01-2004, 10:19
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

The code Shelby quoted is just generic idea for you as to what Word object to use to show the File dialog box.

I would use the fist code Shelby posted using Windows API function to show the file open dialog. It is more portable and doesn't require anything application-specific (neither from Draw nor from Word).

Just copy the contents of ShowOpenFile subroutine into your code and place all the declarations at the beginning of a code module and you should be able to do it.
Reply With Quote
  #12  
Old 26-01-2004, 14:39
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

This is what I have so far:
Code:
Sub UserForm1_Initialize()

End Sub

Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub cmdBrowse_Click()
    Call ShowOpenFile
End Sub

Private Sub OKButton_Click()
    Me.Hide

' ******************
' Open Form Template
' ******************
    Documents.Add Template:= _
        "C:\Documents and Settings\Artist\Application Data\Microsoft\Templates\orderform.dot" _
        , NewTemplate:=False, DocumentType:=0
    
' ************
' Zoom To Page
' ************
    ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitFullPage
    
' *************************
' Insert text into document
' *************************
    ' Text insertion area

    Unload Me
End Sub
Sub ShowOpenFile()
Dim OFName As OPENFILENAME
Dim sPath As String

    OFName.lStructSize = Len(OFName)
    OFName.hwndOwner = 0&
    OFName.hInstance = 0&
    OFName.lpstrFilter = "CDR - CorelDRAW" + Chr$(0) + "*.cdr"
    OFName.lpstrFile = Space$(254)
    OFName.nMaxFile = 255
    OFName.lpstrFileTitle = Space$(254)
    OFName.nMaxFileTitle = 255
    sPath = GetBackEnd
    If sPath = vbNullString Then
        OFName.lpstrInitialDir = "c:\"
    Else
        sPath = Left(sPath, InStrRev(sPath, "\") - 1)
        If Len(Dir(sPath, vbDirectory)) > 0 Then
            OFName.lpstrInitialDir = sPath
        Else
            OFName.lpstrInitialDir = "c:\"
        End If
    End If
    OFName.lpstrTitle = "Open a CDR File (*.cdr)"
    OFName.flags = 0

    If GetOpenFileName(OFName) Then
        BrowseOpenFile = OFName.lpstrFile
        MsgBox BrowseOpenFile
    Else
        BrowseOpenFile = vbNullString
        MsgBox "No file Selected."
    End If
End Sub
Private Sub TestArea()
    
End Sub
When I test the form and click the browse button, I get the error msg below. the compiler highlites the "OFName As OPENFILENAME" part of the code. what am I doing wrong. I hate to be a pain about this. I just thought it might be a little easier.
Attached Images
 
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #13  
Old 27-01-2004, 06:10
Lev
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by ddonnahoe
When I test the form and click the browse button, I get the error msg below. the compiler highlites the "OFName As OPENFILENAME" part of the code. what am I doing wrong. I hate to be a pain about this. I just thought it might be a little easier.
You have scipped
Private Type OPENFILENAME
declaration in your code
Reply With Quote
  #14  
Old 27-01-2004, 10:58
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

Thanks to everyone who has helped me with this project. I am near completion. I finally figured out the same thing that Lev told me. Thanks Lev. I only have one more hurdle, but I think I can manage myself. Once again, thanks for all of your help, Alex, Lev, and ShelbyM. You guys are great.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #15  
Old 27-01-2004, 12:09
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Sean,

You might want to read a Programming Guide for CorelDRAW which is called "dvba_pg.pdf" and stored in Programs folder of your CorelDRAW installation. I know the name of the file is strange but the contents of the document is quite good. It should help you with the basic VBA stuff quite a lot.
Reply With Quote
  #16  
Old 27-01-2004, 12:51
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

Thanks Alex. I found this document a long time ago and have printed it out. In my stubborness, I haven't read much of it because I like to experiment adn learni things on my own. Most of the solutions to the questions I have posted, have come shortly after my post, before they were even answered, just by tweaking or having an epiphany. Kinda like a blonde moment. LOL. Anyway, Thank you so much for this forum. It has helped tremendously.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
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
format text dialog box implement graphicdesigner CorelDRAW/Corel DESIGNER VBA 5 22-12-2004 14:37
Save Dialog Box Mark CorelDRAW/Corel DESIGNER VBA 1 21-07-2004 07:15
Problem with opened dialog box Corel Draw 11 dergy CorelDRAW/Corel DESIGNER VBA 1 14-06-2004 11:04
Show "Edit text" Dialog? joexx CorelDRAW/Corel DESIGNER VBA 1 02-10-2003 20:30
Missing font dialog on import click101 CorelDRAW/Corel DESIGNER VBA 2 28-04-2003 13:32


All times are GMT -5. The time now is 13:11.


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