LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sort (in Excel) from code in MSProject

I have written code in Microsoft Project which creates an
excel workbook and then creates a report in excel from
information in Project.
When I have finished the report I want to sort it on a
certain field, but I can't get the Sort to work.
I have had various errors but the latest is
"application or object defined error"

I have set up the code like this (remembering that this is
written in a module in Microsoft project)

- Check to see if excel is running with
Set MyXL = GetObject(, "Excel.Application")
and if this produces an error I start Excel with
Set MyXL = CreateObject("Excel.Application")

I then create a new workbook with

MyXL.Application.Workbooks.Add
outbook = MyXL.Application.ActiveWorkbook.Name

and then proceed to fill the report using:

With MyXL.Application.Workbooks(outbook).ActiveSheet
<fill report with data

While still within the WITH statement I have tried
to sort the report with:

..Range("A1:L" & CStr(Rownum - 1)).Sort Key1:=Range("K2"),
Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:=False, Orientation:=xlTopToBottom

But it won't work.

Any suggestions??

Peter


 
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
Have the need to sort text code-values within same Excel cell A.X M.D Excel Worksheet Functions 2 December 3rd 09 07:26 PM
excel date scheduling not msProject 4pinoy Excel Worksheet Functions 0 November 11th 06 08:33 PM
Linking Data from MSProject to Excel OgdenLB Excel Discussion (Misc queries) 0 March 9th 06 12:31 AM
Hyperlink from MSProject to Excel? Tony H. Excel Discussion (Misc queries) 0 August 5th 05 06:52 PM
Zip code sort is an Excel problem even when using the special cat. camead Excel Discussion (Misc queries) 2 March 31st 05 01:15 AM


All times are GMT +1. The time now is 11:15 PM.

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

About Us

"It's about Microsoft Excel"