View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
friend8899 friend8899 is offline
external usenet poster
 
Posts: 1
Default Subscript out of ranges - Friend8899


I am new in Excel VBA program. I have recently try to write a program
in order to write the data to DBF file. I encountered Subscript out of
range. The program does not seem to detect the DBF file even I open the
file. Can someone please help. Thanks in advance for your help.


Sub Open_file()
Dim DBase_File As String
Dim Home As String
Home = ActiveWorkbook.Name
DBase_File = Sheets("Options").Range("C7")
Workbooks.Open Filename:=DBase_File
Workbooks(Home).Activate
Call Update_GL
End Sub


Sub Update_GL()
Dim TB_Rec As Long
Dim DBase_File As String
Dim Dbase_Sht As String

TB_Rec = Sheets("Options").Range("C21")
DBase_File = Sheets("Options").Range("C7")
Dbase_Sht = Sheets("Options").Range("C8")
Sheets("Payment").Activate.Range("A4:A" & TB_Rec&, "C4:C" &
TB_Rec). _
Copy
Destination:=Workbooks(DBase_File).Sheets(Dbase_Sh t).Range("A1")

End Sub


The variable defined in the Option file as follows :


LIST OF WORKBOOK TO OPEN
File name Folder
DBase_File C:\Mydocument\gltest.dbf
Dbase_Sht gltest


No. of Record 5 (TB_Rec)


--
friend8899
------------------------------------------------------------------------
friend8899's Profile: http://www.excelforum.com/member.php...o&userid=24233
View this thread: http://www.excelforum.com/showthread...hreadid=378465