Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

type mismatch error help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryan.fitzpatrick3@safeway.com - 28 Nov 2007 18:22 GMT
I get a type mismatch error on this. I have one book that is on
windows scheduler, when it opens (on the scheduled time) it auto runs
the macro's in another workbook. It works perfectly except I want it
to close all workbooks without prompting me "do you want to save". How
can I do this without getting a type mismatch error?

Sub Auto_Open()

'The following  code provides a general outline to do what you
describe.

Workbooks.Open Filename:= _
       "C:\Documents and Settings\rfitz03\Desktop\RYAN'S EXCEL SHEETS
\Strategic Sourcing\Forms\Position Sheet\Flour Position Sheet
2008-1.xls"

Application.Run "'Flour Position Sheet 2008-1.xls'!Access_Data"
Application.Run "'Flour Position Sheet 2008-1.xls'!
Mail_Plant_Info_Range_without_prompt"

       Application.DisplayAlerts = False
       Workbooks("Automation.xls").Close
       Workbooks("Flour Position Sheet 2008-1.xls").Close
       Application.DisplayAlerts = True
ThisWorkbook.Saved = True
Application.Quit

End Sub
dan dungan - 28 Nov 2007 18:35 GMT
I think you need to move this line--"Application.DisplayAlerts = True"
to after "ThisWorkbook.Saved = True"

On Nov 28, 10:22 am, ryan.fitzpatri...@safeway.com wrote:
> I get a type mismatch error on this. I have one book that is on
> windows scheduler, when it opens (on the scheduled time) it auto runs
[quoted text clipped - 24 lines]
>
> End Sub
ryan.fitzpatrick3@safeway.com - 28 Nov 2007 18:41 GMT
> I think you need to move this line--"Application.DisplayAlerts = True"
> to after "ThisWorkbook.Saved = True"
[quoted text clipped - 29 lines]
>
> > End Sub

This doesn't work, it closes out the automation workbook but not both.
Jim Thomlinson - 28 Nov 2007 18:39 GMT
The close method has a couple of optional arguments. The first is to save
changes...

Workbooks("Automation.xls").Close SaveChanges:=False
Signature

HTH...

Jim Thomlinson

> I get a type mismatch error on this. I have one book that is on
> windows scheduler, when it opens (on the scheduled time) it auto runs
[quoted text clipped - 24 lines]
>
> End Sub
ryan.fitzpatrick3@safeway.com - 28 Nov 2007 18:53 GMT
On Nov 28, 10:39 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com> wrote:
> The close method has a couple of optional arguments. The first is to save
> changes...
[quoted text clipped - 34 lines]
>
> > End Sub

It didn't close both workbooks just automation book. I took your code
and put the other workbook in it underneath.

       Application.DisplayAlerts = False
       Workbooks("Automation.xls").Close SaveChanges:=True
       Workbooks("Flour Position Sheet 2008-1.xls").Close
SaveChanges:=False
       Application.DisplayAlerts = True
Application.Quit
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.