![]() |
Saveing a file (Confirm Replace)
Im saving my file with the following statements:
With ActiveWorkbook.PublishObjects("Report-builder") ..HtmlType = xlHtmlStatic ..Filename = "C:\Report\Test.htm" ..Publish (False) End With But it overwrites a file with the same name. How do I make it so that is checks if the user would like to overwite or not? Thanks :rolleyes: --- Message posted from http://www.ExcelForum.com/ |
Saveing a file (Confirm Replace)
Rudolph,
Test it yourself If Dir("C:\myTest\Testfile1.xls") < "" Then MsgBox "File exists" Else MsgBox "File does nor exist" End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "rudolpsh " wrote in message ... Im saving my file with the following statements: With ActiveWorkbook.PublishObjects("Report-builder") HtmlType = xlHtmlStatic Filename = "C:\Report\Test.htm" Publish (False) End With But it overwrites a file with the same name. How do I make it so that is checks if the user would like to overwite or not? Thanks :rolleyes: --- Message posted from http://www.ExcelForum.com/ |
Saveing a file (Confirm Replace)
|
Saving a file (Confirm Replace)
Hi,
Insert a module and paste the following declaration to the header of this module : Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long then in the code you can check, if the file exist : if CBool(PathFileExists("C:\Report\Test.htm"))) then do something else do something else end if --- Message posted from http://www.ExcelForum.com/ |
Saving a file (Confirm Replace)
|
All times are GMT +1. The time now is 02:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com