B
Bill
Greetings,
I get a run-time error of 424 at line
" Me![Density].value.copy"
In the following
Private Function Fred()
Dim strA As String
Dim strB As String
Dim rng1 As Excel.Range
Dim rng2 As Excel.Range
Dim oSheet As Excel.Worksheet
strA = Me![Density]
strB = Me![Rate]
If Not IsNull(Me![Density]) And Not IsNull(Me![Rate]) Then
ExcelRunning = IsExcelRunning
If Not ExcelRunning Then
Set xlapp = CreateObject("Excel.Application")
Else
Set xlapp = GetObject(, "Excel.Application")
End If
Set xlbook = xlapp.Workbooks.Open("C:\Database\ltd calcs sheet.xls")
Set oSheet = xlapp.Worksheets("Quick RV Sizing")
xlapp.Visible = True
Me![Density].Value.Copy
Set rng1 = oSheet.Range("b3")
oSheet("Quick RV Sizing").Range(rng1.Address).PasteSpecial
Paste:=xlPasteValues
Me![Rate].Value.Copy
Set rng2 = oSheet.Range("b4")
oSheet("Quick RV Sizing").Range(rng1.Address).PasteSpecial
Paste:=xlPasteValues
Else
'do nothing
End If
End Function
My hope - not working at present - is to take the vlaues in the fields of
the current form and paste them into cells in aN Excel worksheet before it
opens.
(The spreadsheet is a calculation).
Is there a way to do this - that is simple - and works?.
Thanx
Best regards
Bill
I get a run-time error of 424 at line
" Me![Density].value.copy"
In the following
Private Function Fred()
Dim strA As String
Dim strB As String
Dim rng1 As Excel.Range
Dim rng2 As Excel.Range
Dim oSheet As Excel.Worksheet
strA = Me![Density]
strB = Me![Rate]
If Not IsNull(Me![Density]) And Not IsNull(Me![Rate]) Then
ExcelRunning = IsExcelRunning
If Not ExcelRunning Then
Set xlapp = CreateObject("Excel.Application")
Else
Set xlapp = GetObject(, "Excel.Application")
End If
Set xlbook = xlapp.Workbooks.Open("C:\Database\ltd calcs sheet.xls")
Set oSheet = xlapp.Worksheets("Quick RV Sizing")
xlapp.Visible = True
Me![Density].Value.Copy
Set rng1 = oSheet.Range("b3")
oSheet("Quick RV Sizing").Range(rng1.Address).PasteSpecial
Paste:=xlPasteValues
Me![Rate].Value.Copy
Set rng2 = oSheet.Range("b4")
oSheet("Quick RV Sizing").Range(rng1.Address).PasteSpecial
Paste:=xlPasteValues
Else
'do nothing
End If
End Function
My hope - not working at present - is to take the vlaues in the fields of
the current form and paste them into cells in aN Excel worksheet before it
opens.
(The spreadsheet is a calculation).
Is there a way to do this - that is simple - and works?.
Thanx
Best regards
Bill