Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding New Workbook
I am trying to manipulate a new worksheet from Access. When running this
code the first time the sheet is created and manipulated with no problem. If I attempt to rerun the code it fails. Run-time Error '1004': Method 'Range' of Object '_Global' failed any ideas as to my instancing the sheet? maybe the wrong method. Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True Set xlWrkbk = xlApp.Workbooks.Add ii = 1 For i = 1 To 15 Step 2 Range("A" & i) = "Pre " & ii ii = ii + 1 Next i |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding New Workbook
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True Set xlWrkbk = xlApp.Workbooks.Add ii = 1 For i = 1 To 15 Step 2 xlWrkbk.Activesheet.Range("A" & i) = "Pre " & ii ii = ii + 1 Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "C Hayes" wrote in message ... I am trying to manipulate a new worksheet from Access. When running this code the first time the sheet is created and manipulated with no problem. If I attempt to rerun the code it fails. Run-time Error '1004': Method 'Range' of Object '_Global' failed any ideas as to my instancing the sheet? maybe the wrong method. Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True Set xlWrkbk = xlApp.Workbooks.Add ii = 1 For i = 1 To 15 Step 2 Range("A" & i) = "Pre " & ii ii = ii + 1 Next i |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding New Workbook
Thank you
"Bob Phillips" wrote: Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True Set xlWrkbk = xlApp.Workbooks.Add ii = 1 For i = 1 To 15 Step 2 xlWrkbk.Activesheet.Range("A" & i) = "Pre " & ii ii = ii + 1 Next i -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "C Hayes" wrote in message ... I am trying to manipulate a new worksheet from Access. When running this code the first time the sheet is created and manipulated with no problem. If I attempt to rerun the code it fails. Run-time Error '1004': Method 'Range' of Object '_Global' failed any ideas as to my instancing the sheet? maybe the wrong method. Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True Set xlWrkbk = xlApp.Workbooks.Add ii = 1 For i = 1 To 15 Step 2 Range("A" & i) = "Pre " & ii ii = ii + 1 Next i |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding values from different workbook | Excel Discussion (Misc queries) | |||
Adding over 30 worksheets in a workbook | New Users to Excel | |||
Adding a chart to large workbook brings workbook activity to a hal | Excel Discussion (Misc queries) | |||
Many users adding to one workbook? | Excel Programming | |||
Adding new workbook! | Excel Programming |