Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default New object/automation error

I need to create a new sheet in my macro. So far the code I've been using
looks something like this:

Dim sheet7 as worksheet
sheet7 = new worksheet

But I keep getting error saying that the object doesn't support automation.
I'm still a new programmer and I'm not sure what automation is. I can't seem
to find any documentation to tell me what I'm doing wrong.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default New object/automation error

Hi Stephen,

Try:

Dim SH As Worksheet

Set SH = Worksheets.Add

---
Regards,
Norman


"Stephen" wrote in message
...
I need to create a new sheet in my macro. So far the code I've been using
looks something like this:

Dim sheet7 as worksheet
sheet7 = new worksheet

But I keep getting error saying that the object doesn't support
automation.
I'm still a new programmer and I'm not sure what automation is. I can't
seem
to find any documentation to tell me what I'm doing wrong.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default New object/automation error

When objects are created or referenced you need the set statement.

Dim wksNew As Worksheet

Set wksNew = Worksheets.Add

Don't use Sheet7 as your variable as Excel uses Sheet1, Sheet2, ... as it's
default names when new sheets are created and you could run into some
difficulties.
--
HTH...

Jim Thomlinson


"Stephen" wrote:

I need to create a new sheet in my macro. So far the code I've been using
looks something like this:

Dim sheet7 as worksheet
sheet7 = new worksheet

But I keep getting error saying that the object doesn't support automation.
I'm still a new programmer and I'm not sure what automation is. I can't seem
to find any documentation to tell me what I'm doing wrong.

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
Automation object question scottrm Excel Programming 1 November 2nd 05 06:34 AM
object does not source automation events josh7 Excel Programming 6 August 21st 05 08:00 PM
Automation Error : The Object Invoked Has Disconnected From Its Clients !! [email protected] Excel Programming 3 June 17th 05 01:17 PM
Automation Error: The Object Invoked Has Disconnected from Its Clients (Excel) Vaibhav Excel Programming 0 September 8th 03 04:57 PM
Automation Error: The Object Invoked Has Disconnected from Its Clients Vaibhav Dandavate Excel Programming 0 September 8th 03 04:05 PM


All times are GMT +1. The time now is 10:24 AM.

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

About Us

"It's about Microsoft Excel"