PC Review


Reply
Thread Tools Rate Thread

Common routines to open many files by name

 
 
=?Utf-8?B?Umljaw==?=
Guest
Posts: n/a
 
      1st Jun 2007
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

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      1st Jun 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder (C/program files/common files-(drivers)) opens on bootup Greybear74 Windows XP Help 3 24th Dec 2008 09:52 AM
"C:\Program Files\Common Files\InstallShield\UpdateService\ISUSPM. Obe Windows XP Help 4 14th Aug 2008 12:53 AM
can't open excel files from common folder =?Utf-8?B?ZHNkcHJvZHVjdGlvbg==?= Microsoft Excel Misc 4 5th Jul 2007 08:34 PM
Why does Windows open C:\Program Files\Common on startup? boe Windows XP Basics 2 12th Sep 2004 05:03 PM
Re: missing"\c;program files\common files\install shield\professioal\run time\1701 Randy Byrne [MVP] Windows XP Hardware 0 31st Aug 2003 03:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:46 PM.