Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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




---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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




---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saveing a file (Confirm Replace)

1000 - thank you's...


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving a file (Confirm Replace)

thank

--
Message posted from http://www.ExcelForum.com

Reply
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
saveing a spreadsheet as html want to keep the outline useable matt Excel Discussion (Misc queries) 0 May 27th 10 11:00 PM
problem saveing excell worksheet karspoz Excel Discussion (Misc queries) 1 March 9th 09 10:38 PM
Saveing workbook to a file as todays date daily mikespeck Excel Worksheet Functions 0 August 22nd 06 01:27 PM
If I accidently replace a saved file can I retrieve the old file? kamabiv Excel Discussion (Misc queries) 1 May 11th 05 10:26 PM
Please confirm the following bug in Excel DennisE Excel Programming 3 December 22nd 03 05:38 PM


All times are GMT +1. The time now is 06:26 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"