LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro gives error 9 unless Administrator

Tim,
That actually turned out to be true - in a way.
But with some more testing, it looks like the error is caused by having the
..xls file and .csv file named the same. Seems to confuse Excel 2003. We
changed the name of the CSV file and now it seems to work. Just a wild guess
and we changed the Broadspire.Csv to test.csv and did not get the error.

Thanks,

Tod Brannen


"Tim Williams" wrote:

That error usually means you don't have a sheet named "Quarterly BCO Detail"
Probably not a security issue.

Try:
ActiveWorkbook.Sheets("Quarterly BCO Detail").Select

or:
Workbooks("Broadspire.xls").Sheets("Quarterly BCO Detail").Range("B16").PasteSpecial _
Paste:=xlValues, Operation:=xlNone, SkipBlanks:= False, Transpose:=False

Always better to be more explicit when selecting/activating and even better not to select/activate at all

Tim


"Free Agent99" wrote in message ...
I posted this in General, but I think it is more of a Programming issue.
As the subject says, I have a working macro (auto_open) that works fine when
i am testing. It simply opens a CSV file and copies cells to the different
sheets in the spreadsheet. However, if someone who is not 'Administrator'
runs it it stops on the first "sheets" command and give an error "subscript
out of range". I tested for a long time before I figured out the problem, but
I
have set Excel security levels at the lowest and changed the security on the
workbook and CSV files to allow "everyone" but it still won't work. What is
the problem? More important, what is the fix?
Tthe CSV file is opened correctly. In fact when the debug error
message is cancelled, I can see both files in Excel by changing windows. The
CSV file shows the data correctly and the first row is selected waiting to be
copied and pasted into the XLS. The error line shown in the debugger is
"Sheets (Broadspire.xls) .select" with error 9 'Subscript out of Range'.
Here is the beginning of the macro :

Sub auto_open()
'
' auto_open Macro
' Macro recorded 5/5/2006 by Tod Brannen
'
' Keyboard Shortcut: Ctrl+o
'
Workbooks.Open Filename:="h:\sme\data\Broadspire.csv" <<< Opens Fine.
Range("A3:H3").Select <<<Selects Fine.
Selection.Copy
Windows("Broadspire.xls").Activate
Sheets("Quarterly BCO Detail").Select <<<<<Error line
Range("B16").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False


Thanks for looking,

Tod Brannen




 
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
How do I tell Excel that I am the administrator? Kevin Excel Discussion (Misc queries) 2 August 15th 09 12:20 AM
Administrator Not2Smart New Users to Excel 1 October 1st 08 06:41 PM
Administrator rights whatzzup Excel Discussion (Misc queries) 3 September 22nd 08 02:52 PM
Excel macro works only for administrator Free Agent99 Excel Discussion (Misc queries) 12 May 15th 06 09:25 PM
Is the user Administrator MrT Excel Programming 9 October 20th 04 09:11 PM


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

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"