Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default opening an excel file from another excel file

use the Dir method. Dir always returns the current directory path then just append the file name to the retuned value

----- Keyur wrote: ----

h

http://www.exceltip.com/st/%20Determine_if_a_workbook_is_already_open_using_V BA_<br%20/in_Microsoft_Excel/472.htm

The function below can be used to determine if a workbook is open o
not:
Function WorkbookOpen(WorkBookName As String) As Boolea
' returns TRUE if the workbook is ope
WorkbookOpen = Fals
On Error GoTo WorkBookNotOpe
If Len(Application.WorkBooks(WorkBookName).Name) 0 The
WorkbookOpen = Tru
Exit Functio
End I
WorkBookNotOpen
End Functio

Example:
If Not WorkbookOpen("MyWorkbookName.xls") Then
Workbooks.Open "MyWorkbookName.xls
End I



i am using the above function in an excel file to check if anothe
excel file is open. both the files are in the same folder. now i hav
to write the complete path since not in My Documents. can i set it u
so it will open the file from the same folder (as the file which ha
this function) without writing the complete path

thanks


--
Message posted from http://www.ExcelForum.com


Reply
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
Resolve Error in opening Excel File zip file from a CD? rw5400 Excel Discussion (Misc queries) 1 March 17th 10 03:41 PM
opening a file in Excel starts application but dose not open file Bob Shelton Excel Discussion (Misc queries) 1 July 2nd 08 07:51 PM
Opening file in Excel 2003 opens multipule instances of same file Ed_B Excel Discussion (Misc queries) 1 June 21st 07 07:10 PM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. Tim Marsden Charts and Charting in Excel 2 October 15th 05 02:10 PM


All times are GMT +1. The time now is 01:54 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"