Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Common routines to open many files by name

I've started this code but it does not open the file. Can you help? BkNme is
loaded in a different routine.

Sub Wrkbk_Open(BkNme)
Dim WorkBk As Workbook
Dim WrkBk As String
Dim BKPath As String
BKPath = "C:\Documents and Settings\Richard L. Harig\My
Documents\Excell\Financials\"
WrkBk = BKPath & BkNme
On Error Resume Next
Set WorkBk = Workbooks(WrkBk)
If WorkBk Is Nothing Then
On Error GoTo Err0pn
Workbooks.Open Filename:=WorkBk, UpdateLinks:=3

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Common routines to open many files by name

When you're using Workbooks(xxxx), you don't specify the folder.

WrkBk = BKPath & BkNme
On Error Resume Next
Set WorkBk = Workbooks(bknme)
....

You still open the file using the path, though.

Rick wrote:

I've started this code but it does not open the file. Can you help? BkNme is
loaded in a different routine.

Sub Wrkbk_Open(BkNme)
Dim WorkBk As Workbook
Dim WrkBk As String
Dim BKPath As String
BKPath = "C:\Documents and Settings\Richard L. Harig\My
Documents\Excell\Financials\"
WrkBk = BKPath & BkNme
On Error Resume Next
Set WorkBk = Workbooks(WrkBk)
If WorkBk Is Nothing Then
On Error GoTo Err0pn
Workbooks.Open Filename:=WorkBk, UpdateLinks:=3


--

Dave Peterson
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
Merge rows from 2 XLS files using a common key field. Gene Excel Discussion (Misc queries) 1 May 20th 08 08:16 PM
can't open excel files from common folder dsdproduction Excel Discussion (Misc queries) 4 July 5th 07 08:34 PM
Open a mail merge from excel: common problem lightspeed Excel Programming 0 July 21st 06 02:09 PM
Open a mail merge from excel: common problem lightspeed Excel Programming 0 July 21st 06 02:03 PM
Hyperlink to open a common dialog on a msgbox Harinath Excel Programming 1 April 28th 04 03:33 PM


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