ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs to existing file (https://www.excelbanter.com/excel-programming/424142-saveas-existing-file.html)

Jan Holmstrom

SaveAs to existing file
 
Hi,

My macro opens a htm file with data and save it to an existing xls file
(2003).

When it runs - I'm asked to accept overwriting the existing file.

Is it possible to make the same rutine - without Excel asking for accept?

My code:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "my path"
Workbooks.Open Filename:= _
"my file.htm"
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub

Best regards

Gary''s Student

SaveAs to existing file
 
Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub
--
Gary''s Student - gsnu200834


"Jan Holmstrom" wrote:

Hi,

My macro opens a htm file with data and save it to an existing xls file
(2003).

When it runs - I'm asked to accept overwriting the existing file.

Is it possible to make the same rutine - without Excel asking for accept?

My code:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "my path"
Workbooks.Open Filename:= _
"my file.htm"
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub

Best regards


Jan Holmstrom

SaveAs to existing file
 
Hi "Gary" Student,

Thank you so much - Your answer solved my problem.

Best regards
Jan holmstrom

"Gary''s Student" skrev:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub
--
Gary''s Student - gsnu200834


"Jan Holmstrom" wrote:

Hi,

My macro opens a htm file with data and save it to an existing xls file
(2003).

When it runs - I'm asked to accept overwriting the existing file.

Is it possible to make the same rutine - without Excel asking for accept?

My code:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "my path"
Workbooks.Open Filename:= _
"my file.htm"
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub

Best regards


Gary''s Student

SaveAs to existing file
 
Glad to help.
--
Gary''s Student - gsnu200834


"Jan Holmstrom" wrote:

Hi "Gary" Student,

Thank you so much - Your answer solved my problem.

Best regards
Jan holmstrom

"Gary''s Student" skrev:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub
--
Gary''s Student - gsnu200834


"Jan Holmstrom" wrote:

Hi,

My macro opens a htm file with data and save it to an existing xls file
(2003).

When it runs - I'm asked to accept overwriting the existing file.

Is it possible to make the same rutine - without Excel asking for accept?

My code:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "my path"
Workbooks.Open Filename:= _
"my file.htm"
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub

Best regards


Doug Glancy

SaveAs to existing file
 
Don't forget to turn DisplayAlerts back on:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub

"Gary''s Student" wrote in message
...
Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub
--
Gary''s Student - gsnu200834


"Jan Holmstrom" wrote:

Hi,

My macro opens a htm file with data and save it to an existing xls file
(2003).

When it runs - I'm asked to accept overwriting the existing file.

Is it possible to make the same rutine - without Excel asking for
accept?

My code:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "my path"
Workbooks.Open Filename:= _
"my file.htm"
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub

Best regards




Jan Holmstrom

SaveAs to existing file
 
Hi Doug,
Thanks for the warning. My macro only runs within the workbook, and it
dosn't effect other workbooks.
Best regards
Jan Holmstrom

"Doug Glancy" skrev:

Don't forget to turn DisplayAlerts back on:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub

"Gary''s Student" wrote in message
...
Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "C:\test\"
Workbooks.Open Filename:= _
"Contact_List.html"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub
--
Gary''s Student - gsnu200834


"Jan Holmstrom" wrote:

Hi,

My macro opens a htm file with data and save it to an existing xls file
(2003).

When it runs - I'm asked to accept overwriting the existing file.

Is it possible to make the same rutine - without Excel asking for
accept?

My code:

Sub HTMTOEXCL()
'
' HTMTOEXCL Makro
' Makro indspillet 15-02-2009 af Jan Holmstrøm
'
ChDir "my path"
Workbooks.Open Filename:= _
"my file.htm"
ActiveWorkbook.SaveAs Filename:= _
"existing file.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
End Sub

Best regards






All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com