Re: Standard FileOpen Window

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Microsoft Public (rod)
Date: 01/14/05


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
> 


Relevant Pages

  • Re: GetOpenFileName to select a .URL file
    ... Note that this link has a listing of the various constants that can be set for the "flags" member of the OPENFILENAME Type, although the actual values are not shown and will need to be Googled for. ... lpstrCustomFilter As String ... Private Sub PickOne() ... OFName.lpstrTitle = "Get Path And Filename" ...
    (microsoft.public.excel.programming)
  • Re: GetOpenFileName to select a .URL file
    ... Note that this link has a listing of the various constants that can be set for the "flags" member of the OPENFILENAME Type, although the actual values are not shown and will need to be Googled for. ... lpstrCustomFilter As String ... Private Sub PickOne() ... OFName.lpstrTitle = "Get Path And Filename" ...
    (microsoft.public.excel.programming)
  • Re: GetOpenFileName to select a .URL file
    ... Gary''s Student - gsnu200781 ... can be set for the "flags" member of the OPENFILENAME Type, ... lpstrCustomFilter As String ... OFName.lpstrTitle = "Get Path And Filename" ...
    (microsoft.public.excel.programming)
  • Re: HttpRequest constructor question!
    ... Jeff wrote: ... I'm about to program a HttpRequest from my asp.net 2.0 website. ... string filename, ... What should be put in filename? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)