ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.GetOpenFilename (https://www.excelbanter.com/excel-programming/450864-application-getopenfilename.html)

Robert Crandal[_3_]

Application.GetOpenFilename
 
This question actually involves Microsoft Word.....

The following code works in Excel, but it gives a compile
error in Word. Does anyone know why?

'--------------------------------------
Public Function MyFileDlg() As String
' This line fails in Word!
NewFN = Application.GetOpenFilename(FileFilter:="Text Files (*.txt), *.txt",
Title:="Please select a file")
If NewFN = False Then
MyFileDlg = ""
Else
MyFileDlg = NewFN
End If
End Function
'-------------------------
Sub Tester()
Dim str As String
str = MyFileDlg
MsgBox str
End Sub





Claus Busch

Application.GetOpenFilename
 
Hi Robert,

Am Sun, 10 May 2015 02:19:03 -0700 schrieb Robert Crandal:

NewFN = Application.GetOpenFilename(FileFilter:="Text Files (*.txt), *.txt",


Word does not work with GetOpenFileName.
Please have a look:
http://www.erlandsendata.no/english/...foldernameword

P.S.: Did you see in the other thread the solution with Regular
Expressions?


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com