rudeboymcc
Registered User.
- Local time
- Today, 00:59
- Joined
- Sep 9, 2008
- Messages
- 69
Hi. Ive got a template in Excel which has references in it that have the same name as the controls on the form that i want in the template.
so far I have:
THe For loop works and loops through all the references (I used a msgbox). THe first test line:
Works fine.
so the line that isn't working is the one inside the for loop.
Basically how do I select a range with name oReference?
so far I have:
Code:
Dim objExcel As Excel.Application
Dim oReference
Set objExcel = New Excel.Application
Set oWB = objExcel.Workbooks.Open("Y:\RDN.xls")
objExcel.Visible = True
oWB.Sheets(1).Range("PeriodFrom").Value = Me.PeriodFrom
For Each oReference In Application.References
oWB.Sheets(1).Range(oReference).Value =
frmCurrentForm.Controls(oBookmark)
Next
THe For loop works and loops through all the references (I used a msgbox). THe first test line:
Code:
oWB.Sheets(1).Range("PeriodFrom").Value = Me.PeriodFrom
so the line that isn't working is the one inside the for loop.
Basically how do I select a range with name oReference?