Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
'document not saved' for 'save' or 'save as' an EXCEL file | Excel Discussion (Misc queries) | |||
Save & Save As features in file menu of Excel | Excel Discussion (Misc queries) | |||
Save Excel file - prompts to save - no Volitile functions used | Excel Worksheet Functions | |||
Excel marcos firing on file save as but not file save | Excel Programming | |||
Trying to *simply* programmicly get a bmp file to be the plotarea backround | Excel Programming |