ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sheet export removes custom toolbars. (https://www.excelbanter.com/excel-programming/352733-sheet-export-removes-custom-toolbars.html)

jinx_uk_98[_7_]

sheet export removes custom toolbars.
 

Hi Guys,

I have a workbook that, when opened, removes all the defult toolbars
and creates a custom bar on wich I have a button to export the current
select sheet to a location.

the problem is that when this code is run is replaces my custom toolbar
with the defult ones.


any ideas?

thanks
kevin


Sub export()
Application.DisplayAlerts = False
Dim newWks As Worksheet
Dim strdate As String
strdate = Format(Now, "dd-mm-yy")
Sheets("summary").Copy
Set newWks = ActiveSheet
With newWks
..Buttons.Delete
With .UsedRange
..value = .value
End With
..Parent.SaveAs Filename:=ThisWorkbook.Path & "\ " & Range("b2").value &
" " & strdate & ".xls", FileFormat:=xlWorkbookNormal
..Parent.Close savechanges:=False
End With
MsgBox "File successfully exported to " & ThisWorkbook.Path
Application.DisplayAlerts = True
End Sub


--
jinx_uk_98
------------------------------------------------------------------------
jinx_uk_98's Profile: http://www.excelforum.com/member.php...o&userid=28878
View this thread: http://www.excelforum.com/showthread...hreadid=509932


Gary L Brown

sheet export removes custom toolbars.
 
Comment out the offending line of code by putting a single quoate in front of
it...ie:

' .Buttons.Delete

HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"jinx_uk_98" wrote:


Hi Guys,

I have a workbook that, when opened, removes all the defult toolbars
and creates a custom bar on wich I have a button to export the current
select sheet to a location.

the problem is that when this code is run is replaces my custom toolbar
with the defult ones.


any ideas?

thanks
kevin


Sub export()
Application.DisplayAlerts = False
Dim newWks As Worksheet
Dim strdate As String
strdate = Format(Now, "dd-mm-yy")
Sheets("summary").Copy
Set newWks = ActiveSheet
With newWks
.Buttons.Delete
With .UsedRange
.value = .value
End With
.Parent.SaveAs Filename:=ThisWorkbook.Path & "\ " & Range("b2").value &
" " & strdate & ".xls", FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With
MsgBox "File successfully exported to " & ThisWorkbook.Path
Application.DisplayAlerts = True
End Sub


--
jinx_uk_98
------------------------------------------------------------------------
jinx_uk_98's Profile:
http://www.excelforum.com/member.php...o&userid=28878
View this thread: http://www.excelforum.com/showthread...hreadid=509932



jinx_uk_98[_8_]

sheet export removes custom toolbars.
 

thanks for the reply.

but If I comment out the offending line .Buttons.Delete the custom
toolbar is still removed.

any other ideas?

Kev


--
jinx_uk_98
------------------------------------------------------------------------
jinx_uk_98's Profile: http://www.excelforum.com/member.php...o&userid=28878
View this thread: http://www.excelforum.com/showthread...hreadid=509932


Gary L Brown

sheet export removes custom toolbars.
 
Then something else is going on that hasn't been posted because the remaining
code does not close the toolbar.
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"jinx_uk_98" wrote:


thanks for the reply.

but If I comment out the offending line .Buttons.Delete the custom
toolbar is still removed.

any other ideas?

Kev


--
jinx_uk_98
------------------------------------------------------------------------
jinx_uk_98's Profile:
http://www.excelforum.com/member.php...o&userid=28878
View this thread: http://www.excelforum.com/showthread...hreadid=509932




All times are GMT +1. The time now is 04:09 PM.

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