LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation Error using xlDialogSaveAs


Hi,
I'm having trouble moving a worksheet to a new workbook and then saving
it to a specific file. The error I'm getting is:

run-time error '-2147221080 (800401a8)':
Automation error.

I have googled and came up with a couple of ideas I adapted and thought
would work but they each still generate the same error. I'm out of
ideas.

Here is my Code:

Private Sub cmdSubCOCopySave_Click()
Dim c As Range, d As Range
Dim NewSht As Worksheet
Dim obj As OLEObject
Dim myshape As Shape
Dim MyPath As String
Dim Str As Variant, Str2 As Variant
Dim Str3 As Variant, Fname As Variant

Call SendToSubConDB 'Tranfers pertinent data to database

Str = ActiveSheet.Range("SubConName").Value
Str2 = "CO " & ActiveSheet.Range("SubCon_CHANGE_ORDER_NO").Value
Str3 = ActiveSheet.Range("ProjectSubVen").Value
Fname = Str & " " & Str2 & " " & Str3
On Error Resume Next
MkDir ThisWorkbook.Path & "\Subcon-Vendor CO\"
MyPath = ThisWorkbook.Path & "\Subcon-Vendor CO\"

ActiveSheet.Move
Set NewSht = ActiveSheet
On Error GoTo 0
Application.Dialogs(xlDialogSaveAs).Show MyPath & Fname & ".xls"
'ActiveWorkbook.SaveAs Filename:=MyPath & Fname & ".xls" This
didn't work either

Application.ScreenUpdating = False
Application.EnableEvents = False

With NewSht
Unprotect ("geekk")
On Error Resume Next
OLEObjects.Visible = True
OLEObjects.Delete
For Each myshape In NewSht.Shapes
Select Case myshape.Type
Case 1: myshape.Delete
Case 17: myshape.Delete
End Select
Next myshape
On Error GoTo 0
Set d = NewSht.Cells.SpecialCells(xlCellTypeFormulas)
For Each c In d
With c
Value = .Value
End With
Next c
Protect ("geekk")
End With
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=559327

 
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
Compile error automation error nikkiws Excel Programming 0 January 17th 06 08:24 AM
compile error automation error [email protected] Excel Programming 0 January 17th 06 08:06 AM
RunTime Error (Automation Error) KD[_3_] Excel Programming 3 January 25th 05 01:56 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM
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 02:44 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"