View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
C Hayes C Hayes is offline
external usenet poster
 
Posts: 3
Default 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