Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, using XL 2000
A simple task but struggling over a solution: The following reports the file path AND name.. FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False then MsgBox "Open " * FileToOpen End if I just need the filename. Any ideas? Thanks, Paul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Paul,
Try this Dim FSO As Object Dim FileToOpen FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False Then Set FSO = CreateObject("Scripting.FileSystemObject") MsgBox "Open " & FSO.getfile(FileToOpen).Name Set FSO = Nothing End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Paul" wrote in message ... Hi, using XL 2000 A simple task but struggling over a solution: The following reports the file path AND name.. FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False then MsgBox "Open " * FileToOpen End if I just need the filename. Any ideas? Thanks, Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks bob. Its pulled the fulename.
How would I use this variable to display a workbook? (make active) Paul Dim FileToOpen FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False Then Set FSO = CreateObject ("Scripting.FileSystemObject") MsgBox "Open " & FSO.getfile(FileToOpen).Name Set FSO = Nothing End If -----Original Message----- Hi Paul, Try this Dim FSO As Object Dim FileToOpen FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False Then Set FSO = CreateObject ("Scripting.FileSystemObject") MsgBox "Open " & FSO.getfile(FileToOpen).Name Set FSO = Nothing End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Paul" wrote in message ... Hi, using XL 2000 A simple task but struggling over a solution: The following reports the file path AND name.. FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False then MsgBox "Open " * FileToOpen End if I just need the filename. Any ideas? Thanks, Paul . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim sStr as String, wkbk as Workbook
sStr = FSO.getfile(FileToOpen).Name on error resume next set wkbk = Workbooks(sStr) On error goto 0 if not wkbk is nothing then wkbk.activate else msgbox sStr & " is not currently open" End if -- Regards, Tom Ogilvy "Paul" wrote in message ... Thanks bob. Its pulled the fulename. How would I use this variable to display a workbook? (make active) Paul Dim FileToOpen FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False Then Set FSO = CreateObject ("Scripting.FileSystemObject") MsgBox "Open " & FSO.getfile(FileToOpen).Name Set FSO = Nothing End If -----Original Message----- Hi Paul, Try this Dim FSO As Object Dim FileToOpen FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False Then Set FSO = CreateObject ("Scripting.FileSystemObject") MsgBox "Open " & FSO.getfile(FileToOpen).Name Set FSO = Nothing End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Paul" wrote in message ... Hi, using XL 2000 A simple task but struggling over a solution: The following reports the file path AND name.. FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False then MsgBox "Open " * FileToOpen End if I just need the filename. Any ideas? Thanks, Paul . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul, the follwoing should do it (untested)
for I = len(FileToOpen) to 1 step -1 if mid(FileToOpen,I,1)="\" Then JustFileName = mid(FileToOpen, I+1) exit For end if Next Robert Flanagan Macro Systems Delaware, U.S. 302-234-9857 http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Paul" wrote in message ... Hi, using XL 2000 A simple task but struggling over a solution: The following reports the file path AND name.. FileToOpen = Application.GetOpenFilename _ ("All Files (*.*), *.*") If FileToOpen < False then MsgBox "Open " * FileToOpen End if I just need the filename. Any ideas? Thanks, Paul |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
another way using InStrRev function JustFileName= Mid(FileToOpen, InStrRev(FileToOpen, "\") + 1) Jare -- Message posted from http://www.ExcelForum.com |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
But that is not available in XL97, so Bob 's solution is more robust.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Jarek " wrote in message ... Hi, another way using InStrRev function JustFileName= Mid(FileToOpen, InStrRev(FileToOpen, "\") + 1) Jarek --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula assitance needed | Excel Worksheet Functions | |||
Assitance W/ An If/Then formula | Excel Discussion (Misc queries) | |||
GetOpenFileName | Excel Programming | |||
getopenfilename | Excel Programming | |||
GetOpenFilename | Excel Programming |