Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation Error help needed


Hi

I am on a sheet called "Menu". I recorded some code that would copy a
worksheet called "Tables(main)" insert it at the end of the workbook
and then rename it to "TABLES"

which copys the sheets perfectly


Code:
--------------------
Sub viewtables()
'
Sheets("menu").Range("h3").Value = 1
Sheets("Tables(MAIN)").Copy Befo=Sheets(9)
Sheets("Tables(MAIN) (2)").Select
Sheets("Tables(MAIN) (2)").Name = "Tables"
Range("A1").Select
Sheets("menu").Range("h3").Value = ""
End Sub
--------------------


then I have this piece of coding on the the Table(main) sheet code


Code:
--------------------
Private Sub CommandButton1_Click()
If ActiveSheet.Name = "Tables" Then
Application.DisplayAlerts = False
Sheets("menu").Activate
Sheets("Tables").Delete
Application.DisplayAlerts = True
exit sub
End If
Sheets("menu").Activate
End Sub
--------------------


the above is surpose to delete the sheet "Tables" and move back to
"Menu"
It works however i get a error "Run-time error '-2147221080(800401a8)':
Automation error. with only and end button enable so I cannot even click
on debug. however when I click end it has already deleted sheet


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544665

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Automation Error help needed

You would probably need to use application.ontime as the sole command in the
click event to fire a macro that contains the functionality.

Private Sub CommandButton1_Click()
Application.OnTime now,"DeleteSheet"
End Sub

in a general Module

Sub DeleteSheet()
If ActiveSheet.Name = "Tables" Then
Application.DisplayAlerts = False
Sheets("menu").Activate
Sheets("Tables").Delete
Application.DisplayAlerts = True
exit sub
End If
Sheets("menu").Activate
end sub

--
Regards,
Tom Ogilvy


"funkymonkUK" wrote:


Hi

I am on a sheet called "Menu". I recorded some code that would copy a
worksheet called "Tables(main)" insert it at the end of the workbook
and then rename it to "TABLES"

which copys the sheets perfectly


Code:
--------------------
Sub viewtables()
'
Sheets("menu").Range("h3").Value = 1
Sheets("Tables(MAIN)").Copy Befo=Sheets(9)
Sheets("Tables(MAIN) (2)").Select
Sheets("Tables(MAIN) (2)").Name = "Tables"
Range("A1").Select
Sheets("menu").Range("h3").Value = ""
End Sub
--------------------


then I have this piece of coding on the the Table(main) sheet code


Code:
--------------------
Private Sub CommandButton1_Click()
If ActiveSheet.Name = "Tables" Then
Application.DisplayAlerts = False
Sheets("menu").Activate
Sheets("Tables").Delete
Application.DisplayAlerts = True
exit sub
End If
Sheets("menu").Activate
End Sub
--------------------


the above is surpose to delete the sheet "Tables" and move back to
"Menu"
It works however i get a error "Run-time error '-2147221080(800401a8)':
Automation error. with only and end button enable so I cannot even click
on debug. however when I click end it has already deleted sheet


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544665


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation Error help needed


thnak you that worked perfectly


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544665

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
Please help, Preparing properties automation needed? Kevin Clark[_2_] Excel Discussion (Misc queries) 0 October 5th 07 09:23 AM
Automation Error ... Urgent help needed Alexander.Kom Excel Programming 0 July 14th 05 10:58 AM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM
Automation remote saveing help needed Kelvin Thomson Excel Programming 1 February 24th 04 02:46 PM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


All times are GMT +1. The time now is 05:25 PM.

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"