Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding values from different workbook Rich Excel Discussion (Misc queries) 0 May 7th 09 04:53 PM
Adding over 30 worksheets in a workbook -E New Users to Excel 4 December 30th 08 06:11 PM
Adding a chart to large workbook brings workbook activity to a hal Dale Excel Discussion (Misc queries) 6 December 29th 08 05:50 PM
Many users adding to one workbook? Ed Excel Programming 8 May 1st 07 08:49 PM
Adding new workbook! aiyer[_26_] Excel Programming 1 June 23rd 04 11:16 PM


All times are GMT +1. The time now is 03:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"