DevanG
06-29-2011, 10:29 AM
So, I get the Automation error (Error 440)
when I try to run a workbook through a few different subs. And yes, i cut out lots of code -- these 3 DO need to be separate.
Public Sub cmdInvest7_Click()
Dim InvestAllo As Workbook
TheFile = Application.GetOpenFilename(FileFilter:="XLS (Comma delimited)(*.xls), *.xls", Title:="Please select a file")
Set InvestAllo = Workbooks.Open(filename:=TheFile)
RKrev = RunRepricing(InvestAllo, TheFile)
End Sub
Public Function RunRepricing(contract As Workbook, filename As String) As Double
Call getAutoSiebelData(contract)
end sub
Private Sub getData(investalloc As Workbook)
dim contract as double
contract = investalloc.Sheets(1).Range("b4").Value ' **FAILS HERE**
end sub
How do I get around this error?
when I try to run a workbook through a few different subs. And yes, i cut out lots of code -- these 3 DO need to be separate.
Public Sub cmdInvest7_Click()
Dim InvestAllo As Workbook
TheFile = Application.GetOpenFilename(FileFilter:="XLS (Comma delimited)(*.xls), *.xls", Title:="Please select a file")
Set InvestAllo = Workbooks.Open(filename:=TheFile)
RKrev = RunRepricing(InvestAllo, TheFile)
End Sub
Public Function RunRepricing(contract As Workbook, filename As String) As Double
Call getAutoSiebelData(contract)
end sub
Private Sub getData(investalloc As Workbook)
dim contract as double
contract = investalloc.Sheets(1).Range("b4").Value ' **FAILS HERE**
end sub
How do I get around this error?