Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SCRIPT OUT OF RANGE ERROR

Status
Not open for further replies.

DIVINEDAR0956

IS-IT--Management
Aug 15, 2002
95
US
I have the following VB that works just fine except for two causes:

Public Sub EditProjectNumber()
Dim xl As Object
Dim Wb As Object
Dim sht As Object
Set xl = Excel.Application
' If you want Excel to appear, use next line:
xl.Visible = True

xl.Dialogs(xlDialogOpen).Show "C:\Cost"
Set Wb = xl.ActiveWorkbook
Set sht = Wb.Sheets("PROJECT_INFORMATION")
End Sub

1. It gives me a SCRIPT OUT OF RANGE
2. When it opens the excel file choosen, the next time you open it, it comes in read-only and says that it's being used by another user. Could this be because I have the workbook as shared .

Thank you. Darlene Sippio
dsippio@comtechsystems.com
 
You're getting the "used by another user" error on the second opening because you're not closing it programmatically one the first run through your code. From memory, something like
Code:
xl.Close
or
Code:
xl.Quit
at the end of your code may help. [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top