January 22nd, 2013, 07:51 AM
Is there any way then to SaveAs without taking the focus off the original spreadsheet
Is there any way then to SaveAs without taking the focus off the original spreadsheet?
I want to SAVE a copy of the workbook(XLSM) as XML in the background.
January 22nd, 2013, 05:27 PM
You'll probably need to write some vba code.
Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
January 22nd, 2013, 06:02 PM
Originally Posted by Doug G
Yes I hoping to get some help with that part.
I got this far but the macro seems to stop executing after the SAVEAS the next two line CLOSE and OPEN the original don't happen.
reopen = ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:="C:\Users\me\Documents\xmlbook2.xml", FileFormat:=xlXMLSpreadsheet
I was wondering if this should be done using "external" script perhaps WSH assuming I can't overcome the probelm above.
January 23rd, 2013, 10:01 AM
Originally Posted by datanull
I made a VBSCRIPT program that works as I wanted. Now all I have to do is figure out how to make a button in excel that calls this program.
Const xlXMLSpreadsheet = 46
Set objExcel = GetObject(,"Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.ActiveWorkbook
reopen = objWorkbook.Name
path = objWorkbook.Path
sArray = Split(reopen,".")
objWorkbook.SaveAs path & "\" & sArray(0),xlXMLSpreadsheet
objExcel.Workbooks.Open path & "\" & reopen
February 2nd, 2013, 10:30 AM
name v fullname
Your problem is that activeworkbook.name is just the name of the file, you need path and name to open a file, activeworkbook.fullname is the name and path
All your code needs is an extra "full" and it will work fine
Just a thought, the way you have it your code will reopen the original file as it was before any edits, if you want it to be as it is after any edits you have done use:
Nameaandthepath = ActiveWorkbook.FullName
ActiveWorkbook.SaveAs Nameaandthepath & "xx"
Last edited by GGriggs; February 2nd, 2013 at 10:40 AM.