Sam Summers
Registered User.
- Local time
- Today, 16:58
- Joined
- Sep 17, 2001
- Messages
- 939
Hi everyone,
This is my second day on this and basically i don't have a clue what i'm doing!
I have tried everything i can find an am nearly there.
Basically i am trying to insert certain data from a form into an existing Excel spreadsheet - i need to insert this data into the row below the header row. Thats all and then move the row down ready for the next new record next time the user saves one from the database form.
This is the code i am currently using:
But i am now getting this error message - "Object variable or With Block variable not set"
Many thanks in advance
This is my second day on this and basically i don't have a clue what i'm doing!
I have tried everything i can find an am nearly there.
Basically i am trying to insert certain data from a form into an existing Excel spreadsheet - i need to insert this data into the row below the header row. Thats all and then move the row down ready for the next new record next time the user saves one from the database form.
This is the code i am currently using:
Code:
Dim oBook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRow As Range
Set oBook = GetObject("C:\Users\Sam Summers\Desktop\Tanera Docs\Database Backups\Logistics System\June order form 21.xlsx")
Set oSheet = oBook.Sheets(1)
'insert new row
oRow(2).Insert xlShiftDown
'set value of a cell
oSheet.Cells(1, 1).Formula = Me.PONumber
'...
oBook.Save
'Set oSheet = Nothing
oBook.Close False
But i am now getting this error message - "Object variable or With Block variable not set"
Many thanks in advance