Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / October 2007

Tip: Looking for answers? Try searching our database.

VBA code does not work when file open directly in browser

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ashish.kare@gmail.com - 01 Oct 2007 08:13 GMT
Hi,

We are having one Excel file which contain macros. The user has two
options to download this report output file, they can download and
save to harddisk OR open report into browser directly by using Open
command. On the sheet, we gave sort order functionality. The sort
order code work correct when user used Download and Save option.

However when user used open command to open report directly into
browser, report open correct but sort order code not work.

The line where i m getting error is given below

sSheetName = ActiveSheet.Name

Also i m attaching complete code below: Please provide me solution....

   Sheets(sSheetName).Select

   ' Find Number of Rows
   Sheets(sSheetName).Cells(10, 1).Select
   intKeyRow = Selection.End(xlDown).Row

   Sheets(sSheetName).Range("A9:Q" & intKeyRow).Select
   intKeyRow = 9

   'Sort by IPTV Column
   If FrmTopIssue.optIPTV.Value = True Then
       Selection.Sort Key1:=Range("E" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
               OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
   End If

   'Sort By CPV Column
   If FrmTopIssue.optCPV.Value = True Then
       Selection.Sort Key1:=Range("F" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
               OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
   End If
   'Sort By Cost Column
   If FrmTopIssue.optCost.Value = True Then
       Selection.Sort Key1:=Range("H" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
               OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
   End If
   'Sort By Cases Column
   If FrmTopIssue.optCases.Value = True Then
       Selection.Sort Key1:=Range("I" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
               OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
   End If
   AddRankColumn (sSheetName)
   Sheets(sSheetName).Cells(5, 1).Select

Thanks in advance
Ashish
Dave Peterson - 01 Oct 2007 12:44 GMT
This may not be a good solution for you...

I'd do my best to not let MSIE open the file:

How to Configure Internet Explorer to Open Office
Documents in the Appropriate Office Program Instead of in Internet Explorer
http://support.microsoft.com/?scid=162059

There are just too many things that don't work when an excel file is opened in a
browser.

> Hi,
>
[quoted text clipped - 56 lines]
> Thanks in advance
> Ashish

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.