View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
sparks[_3_] sparks[_3_] is offline
external usenet poster
 
Posts: 12
Default hope someone can help with excel save with 2003 and 2007 installed on my computer

Sorry I was not clear. I was having a very bad day yesterday.
I can running this in Access so excel is running in the background and
a prompt wiill not work.

it works but it will only write an xls file meaning that it will only
save 255 variables and I have 447 so I need a 2007 save.





Private Sub Command40_Click()

Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'oXLPath = """C:\Program Files\Microsoft Office\Office12"" " &
"/automation -Embedding"
'should not be needed if correct paths are set
Set oExcel = CreateObject("Excel.Application")

Set oBook = oExcel.Workbooks.Open("C:\20pagetest.csv")
Debug.Print xlCurrentPlatformText

oBook.SaveAs "c:\booktest.xlsx", xlWorkbookNormal

oExcel.Quit

End Sub


On Thu, 22 Sep 2011 12:11:58 -0700 (PDT), clawdogs
wrote:

Hi. The code below should be input in Thisworkbook object rather than
a seperate macro.. You can also force a name as well..

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.EnableEvents = False
filesavename = Application.GetSaveAsFilename(fileFilter:="Microso ft
Excel File (*.xlsx), *.xlsx")
If filesavename < False Then
On Error Resume Next
Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:=filesavename
Application.DisplayAlerts = True
On Error GoTo 0
End If
Application.EnableEvents = True
Cancel = True
End Sub