Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Sorting excel sheets

Hi,

I'm trying to sort an array sheet using vbscript. I've tried several
possibilities, but to no avail.
Below the code I wrote. It seems correct to me, but for some reason my
application just hangs without giving me an error so I don't see what's

going wrong...


(The excel-file exists, so that cann't be the problem)


Const xlWorkSheet = -4167
Const xlLineMarkers = 65
Const xlNormal = -4143
Const xlLeft = -4131
Const xlCenter = -4108
Const xlRight = -4152
Const xlAscending = 1
Const xlYes = 1
Const xlStroke = 2
Const xlSortColumns = 1


sTemplateFile = Server.MapPath("\test") & "\report-template.xls"
sTargetFile = Server.MapPath("\test") & "\report.xls"


'Create an instance of Excel Application
Set oExcelApp = Server.CreateObject("Excel.Application")
'Open template
Set oExcelWkb = oExcelApp.Workbooks.open(sTemplateFile)
'Save copy in download folder
oExcelWkb.SaveAs sTargetFile, xlNormal
'Specify worksheet
set oExcelSht = oExcelWkb.worksheets(1)


' this is what i've tried so far:
oExcelSht.Range("B11:M281").Sort oExcelSht.Range("E11"), 1


oExcelApp.Selection.Sort oExcelApp.Range("E11"), 1, , , , , , 0


oExcelSht.Columns("B:M").Sort oExcelSht.Range("E11"), 1, , , , , , 0


oExcelSht.Range("B11:M281").Sort oExcelSht.Range("E1")


'Calling a macro to sort isn't an option


Set oExcelSht = Nothing
oExcelWkb.close true
Set oExcelWkb = Nothing
oExcelApp.Quit
Set oExcelApp = Nothing

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
sorting sheets Tim Twilley New Users to Excel 2 June 28th 07 11:06 PM
sorting protected sheets esslingerdav Excel Worksheet Functions 1 September 23rd 06 09:06 AM
Sorting sheets Lp12 Excel Discussion (Misc queries) 3 June 11th 06 05:28 PM
Sorting the order of sheets by the name Ctech[_60_] Excel Programming 4 November 25th 05 04:40 PM
Sorting sheets emilija Excel Programming 2 October 2nd 03 07:38 PM


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

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"