Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default HELP! Programmicly Save an Excel File ?

I am exporting data from a GIS application to Excel.

I am currently just opening a tab delimited file in excel.
The file that opens is somename.txt but it is in excel. To accually get
an 'excel' file the user must do a save as .xls.

I would like to save the somename.txt as somename.xls to take that step
out or the operation. I would also like the excel file so I can
manipulate it and create some new worksheets and compile some simple
statistics.

Current Code:
Open filepath_Export & "Selection_Set.txt" For Output As #1
Print #1, strHeaderRow & vbCr & sData
Close #1

'Open the new text file in Excel
Shell GetAssociatedExecutable(".xls") & " " & _
Chr(34) & filepath_Export & "Selection_Set.txt" &
Chr (34), vbNormalFocus

Some code here to save the file or active window file or
something


Thanks,

Charles

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default HELP! Programmicly Save an Excel File ?


Solved my own problem

Solution.. Record a macro and stick it on a button.

Dim plGetPathString As String
Dim filepath As String

plGetPathString = ""
filepath = Trim$(ActiveWorkbook.FullName)

While InStr(filepath, "\")
plGetPathString = plGetPathString & Left$(filepath,
InStr(filepath, "\"))
filepath = Mid$(filepath, InStr(filepath, "\") + 1)
Wend
If Len(Dir("" & plGetPathString & "Selection_Set.xls")) 1 Then
'MsgBox "file exists"
ActiveWorkbook.SaveAs Filename:="" & plGetPathString &
"Selection_Set_" & Rnd() & ".xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False, Accessmode:=xlNoChange,
ConflictResolution:=xlUserResolution
Else
ActiveWorkbook.SaveAs Filename:="" & plGetPathString &
"Selection_Set.xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False, Accessmode:=xlNoChange,
ConflictResolution:=xlUserResolution
End If

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
'document not saved' for 'save' or 'save as' an EXCEL file Judy Chuang Excel Discussion (Misc queries) 1 July 11th 05 10:12 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM
Excel marcos firing on file save as but not file save Andy Excel Programming 1 August 3rd 04 10:34 AM
Trying to *simply* programmicly get a bmp file to be the plotarea backround Max Zweizig Excel Programming 0 January 7th 04 07:29 PM


All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"