View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Free Agent99
 
Posts: n/a
Default Excel macro works only for administrator

Ok, I will try anything. But that would not explain why it does work for the
admistrator login and no one else.

Tod Brannen

"Miguel Zapico" wrote:

It looks like it is messing with the name of the worksheet somehow. If the
structure of the file is not changing, a possible workaround is using the
index of the sheet instead of the name, something like:
Sheets(1).Select
You have to figure out what is the index number of the sheet, it will be
usually the position of the tab, but it may not. In any case, it is not a
very safe practice (backup the file!), but it may do the trick.

Miguel.

"Free Agent99" wrote:

Miguel,

Thanks, but the 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 (myexcelfile.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