Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default subscript out of range

Hello,

While I execute the following code, I get "subscript out of range" error at
the last line.
The file "Report_2009-04-16.xls" exists in the location mentioned in vPath.
Could any body help me out here please ...

Dim srcDBName As String
Dim xlw_source As Excel.Workbook

inpDate = "2009-04-16"
vPath = ThisWorkbook.Path
srcDBName = vPath & "\" & "Report_" & inpDate & ".xls"
Set xlw_source = Excel.Workbooks(srcDBName)

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default subscript out of range

Set xlw_source = Workbooks.Open(srcDBName)

--
If this post helps click Yes
---------------
Jacob Skaria


"Sri via OfficeKB.com" wrote:

Hello,

While I execute the following code, I get "subscript out of range" error at
the last line.
The file "Report_2009-04-16.xls" exists in the location mentioned in vPath.
Could any body help me out here please ...

Dim srcDBName As String
Dim xlw_source As Excel.Workbook

inpDate = "2009-04-16"
vPath = ThisWorkbook.Path
srcDBName = vPath & "\" & "Report_" & inpDate & ".xls"
Set xlw_source = Excel.Workbooks(srcDBName)

--
Message posted via http://www.officekb.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default subscript out of range

Need to make sure the instance exists and is properly referenced:

Sub dural()
Dim xlw_source As Workbook
Dim srcDBName As String
srcDBName = "C:\test\beta.xls"
shortName = "beta.xls"
Workbooks.Open Filename:=srcDBName
Set xlw_source = Excel.Workbooks(shortName)
End Sub

--
Gary''s Student - gsnu200846


"Sri via OfficeKB.com" wrote:

Hello,

While I execute the following code, I get "subscript out of range" error at
the last line.
The file "Report_2009-04-16.xls" exists in the location mentioned in vPath.
Could any body help me out here please ...

Dim srcDBName As String
Dim xlw_source As Excel.Workbook

inpDate = "2009-04-16"
vPath = ThisWorkbook.Path
srcDBName = vPath & "\" & "Report_" & inpDate & ".xls"
Set xlw_source = Excel.Workbooks(srcDBName)

--
Message posted via http://www.officekb.com


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default subscript out of range

Hello Jacob,

Thansk for your reply. It works fine.

Sri



Jacob Skaria wrote:
Set xlw_source = Workbooks.Open(srcDBName)

Hello,

[quoted text clipped - 10 lines]
srcDBName = vPath & "\" & "Report_" & inpDate & ".xls"
Set xlw_source = Excel.Workbooks(srcDBName)


--
Message posted via http://www.officekb.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
Subscript out of range OKHM Excel Discussion (Misc queries) 0 August 6th 09 05:18 PM
Subscript out of range KJ MAN[_2_] Excel Programming 26 September 17th 08 04:11 AM
subscript out of range [email protected] Excel Programming 5 February 19th 07 08:28 PM
Subscript out of range? Jason Hancock Excel Programming 3 May 26th 04 07:11 PM
Subscript out of range Stacy Haskins[_2_] Excel Programming 4 April 10th 04 05:41 AM


All times are GMT +1. The time now is 06:17 AM.

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

About Us

"It's about Microsoft Excel"