LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Open an Excel File from Selected Cell

Nice to hear from you again. I wonder if I can ask you a question regarding
VBA. I have a program that open an excel file from select cell (see below).
However, this program opens file just from the same directories. What happen
if Ithe last directory changes all the time. For example instead 100 could be
200 or 300 or 400 and so on. Can the program be adjusted to get this new
directory and find the file?



Thanks in advance.

Maperalia.







'***PROGRAM STARTS*****

Sub OpenSelectFilename1()

directory = "C:\Test\Pants\Blue\100 "\"
filetext = Selection.Value & ".xls"
Workbooks.Open directory & filetext

'If filetext = ".xls" Then
'MsgBox "Please a FILE NAME to Open the file"
'End If

End Sub

"***PROGRAM ENDS*******




'***OTHER PROGRAM STARTS*****

'Sub OpenExcelFile()
' directory = ThisWorkbook.Path & "\"
' filetext = Selection.Value & ".xls"
' If filetext = ".xls" Then
' MsgBox "Please a FILE NAME to Open the file"
' Exit Sub
' End If


"***PROGRAM ENDS*******


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
How can I make an Excel file selected in Explorer open automatica. jddugan Excel Discussion (Misc queries) 1 December 29th 09 10:40 PM
Open pdf file selected from excel damorrison Excel Discussion (Misc queries) 4 September 23rd 08 02:14 PM
Excel file does not open when selected airnet Excel Discussion (Misc queries) 2 July 21st 08 08:36 PM
EXCEL SELECTED FILE DOES NOT OPEN ONLY BLANK EXCEL MUST GO THROUG. jcjnew Excel Discussion (Misc queries) 1 September 22nd 05 09:10 AM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"