Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Saving a workbook with VBA.....


Reply
 
Thread Tools Display Modes
  #1  
Old 11-01-2004, 05:25 AM
KnooKie KnooKie is offline
Senior Contributor
 
Join Date: May 2003
Location: London
Posts: 802
Default Saving a workbook with VBA.....


i am wanting to save a workbook which i can do fine but the part i am having trouble with is if the workbook already exists. If it does exist i want to overwrite it without the popup 'Do you want to overwrite' message coming up.

i thought the following might work but the popup still seems to appear.....

Code:
Set xlWb = XLapp.Workbooks.Add
xlWb.SaveAs FileName:=FileLocation & DirName & (Left(DirName, Len(DirName) - 1)), ConflictResolution:=xlLocalSessionChanges
any ideas please
Reply With Quote
  #2  
Old 11-01-2004, 06:07 AM
Greychild's Avatar
Greychild Greychild is offline
Centurion
 
Join Date: Jan 2004
Location: Hong Kong
Posts: 176
Default

What you need is

Code:
Application.DisplayAlerts = False 'Code to save file Application.DisplayAlerts = True

Don't forget to set the DisplayAlerts back to true, or you won't get warning messages prompting you to save Excel files as you close them. That can be VERY annoying, as a lot of people rely on that message.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->