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 / Outlook / Programming VBA / May 2008

Tip: Looking for answers? Try searching our database.

Close a Excel Workbook when close a userform in Outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lars.oyangen@hamstad.no - 08 May 2008 13:00 GMT
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Set objXL = GetObject(, "Excel.Application")

x = objXL.Workbooks.Application.ActiveWorkbook.Name

If x = "Prosjekt.xls" Then
  objXL.x.Close savechanges:=True ' ?????????
End If

End Sub

Need help!
Ken Slovak - [MVP - Outlook] - 08 May 2008 14:21 GMT
You are trying to call the Close method on the Name property of the
workbook. Try getting the workbook as an object and calling its Close
method.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
> Integer)
[quoted text clipped - 9 lines]
>
> Need help!
lars.oyangen@hamstad.no - 08 May 2008 14:54 GMT
Thanks, this works:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)

Dim XLObject As Object
Set XLObject = GetObject("H:\Outlook\Prosjekt.xls")
XLObject.Close SaveChanges:=True

End Sub

Rate this thread:






 
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.