Re: Standard FileOpen Window
From: Microsoft Public (rod)
Date: 01/14/05
- Next message: Lee: "Re: Experienced PM, Project Programming Newbie!"
- Previous message: Microsoft Public: "Re: Project Guide guide"
- In reply to: Jeff Jones: "Re: Standard FileOpen Window"
- Next in thread: Jeff Jones: "Re: Standard FileOpen Window"
- Reply: Jeff Jones: "Re: Standard FileOpen Window"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 Jan 2005 17:40:10 +1300
Hi,
For Project 2002 and 2003 you can also use the File Browse method in the
Office library.
-- Rod Gill Project MVP "Jeff Jones" <jpjones23@earthlink.net> wrote in message news:0ml5u09290h3itl9jse3jgti0tnherthj3@4ax.com... > Just in case anyone is interested, here's the code I ended up putting > together that does what I wanted. > > Jeff > > 1. Add these declarations at the start of your module, before the > first > procedure: > Declare Function GetOpenFileName _ > Lib "comdlg32.dll" _ > Alias "GetOpenFileNameA" _ > (pOpenfilename As OPENFILENAME) _ > As Boolean > > Private Type OPENFILENAME > lStructSize As Long > hwndOwner As Long > hInstance As Long > lpstrFilter As String > lpstrCustomFilter As String > nMaxCustFilter As Long > nFilterIndex As Long > lpstrFile As String > nMaxFile As Long > lpstrFileTitle As String > nMaxFileTitle As Long > lpstrInitialDir As String > lpstrTitle As String > flags As Long > nFileOffset As Integer > nFileExtension As Integer > lpstrDefExt As String > lCustData As Long > lpfnHook As Long > lpTemplateName As String > End Type > > 2. Add this function somewhere in your module: > Function FileName() > > Dim ProjectFile As OPENFILENAME > > With ProjectFile > > .lStructSize = Len(ProjectFile) > > .hwndOwner = 0 > .hInstance = 0 > .lpstrFile = Space$(254) > .nMaxFile = 255 > .lpstrFileTitle = Space$(254) > .nMaxFileTitle = 255 > .lpstrInitialDir = Chr$(0) > .flags = 0 > ' Following is the Dialog Title > .lpstrTitle = "Select Project File" > ' Following is a filter for the type of file - > ' (a) a literal which is displayed in the Files of > Type box, > and > ' (b) a filter restricting the files shown > ' Change these according to your needs. > .lpstrFilter = "Microsoft Project Files (*.mp*)" + > Chr$(0) + > "*.mp*" + Chr$(0) > > End With > > If GetOpenFileName(ProjectFile) Then > FileName = Trim$(ProjectFile.lpstrFile) > Else > Exit Function > End If > > End Function > > 3). Finally call the function when you need it, for example: > OPENFILENAME = FileName() > If OPENFILENAME = "" Then > Exit Sub > End If > strFileName = OPENFILENAME 'work with strFileName like any > other > variable > > > > > On Thu, 06 Jan 2005 22:03:33 GMT, Jeff Jones <jpjones23@earthlink.net> > wrote: > >>I've written a little group of macros that take a text file to build a >>schedule with its data. I've been unable to get the standard >>"Filename = Application.GetOpenFilename()" function to work because I >>get an error message stating that the Object doesn't support this >>property or method." >> >>My question is, have any of you gotten a standard file open window to >>work with MS project? >> >>Thank you, >>Jeff >
- Next message: Lee: "Re: Experienced PM, Project Programming Newbie!"
- Previous message: Microsoft Public: "Re: Project Guide guide"
- In reply to: Jeff Jones: "Re: Standard FileOpen Window"
- Next in thread: Jeff Jones: "Re: Standard FileOpen Window"
- Reply: Jeff Jones: "Re: Standard FileOpen Window"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|