Open Excel ReadOnly

J

June

#1 How do I open excel in read only?
#2 If I have another spreadsheet open it brings it to the front of the screen but my requested spreadsheet doesn't open

I was able to find an example on here to get the spreadsheet to work so please give me an example of what I need to do
Thanks a bunch
Jun

Dim MyObject As Objec
Dim strFile As Strin

strFile = "T:\projects\configurations.xls

Set MyObject = GetObject(strFile
MyObject.Application.Visible = Tru
MyObject.Parent.Windows(1).Visible = Tru
 
J

June-Belongs under Coding I think

Sorry, I think this should probably go under coding. I realized I had the wrong one after I clicked the send key.
 
J

Jim/Chris

This is a previous post by MVP Ken Snell. I save quite
abit of Ken's posts.

This is a generic code for opening an EXCEL workbook in
"read-only" mode, reading the contents of a specific cell
on a specific worksheet, saving that value into a variable
(VariableName), and then closing the workbook and EXCEL down.

Dim xlsApp As Object, xlsWB As Object, xlsWS As Object,
xlsRng As Object
Set xlsApp = CreateObject("Excel.Application")
Set xlsWB =
xlsApp.Workbooks.Open("C:\FolderName\FileName.xls", , True)
Set xlsWS = xlsWB.Worksheets("WorkSheetName")
Set xlsRng = xlsWS.Range("A1")
VariableName = xlsRng.Value
Set xlsRng = Nothing
Set xlsWS = Nothing
xlsWB.Close False
Set xlsWB = Nothing
xlsApp.Quit
Set xlsApp = Nothing


Good luck

Jim
-----Original Message-----
#1 How do I open excel in read only?
#2 If I have another spreadsheet open it brings it to the
front of the screen but my requested spreadsheet doesn't open.
I was able to find an example on here to get the
spreadsheet to work so please give me an example of what I
need to do.
 
J

June

Jim,
Thanks for the response. That does'nt work for me and I also failed to say I have Access 2002.

Still stumped,
June
 
K

Ken Snell

"...doesn't work for me..." means what? You get an error? Nothing happens?
ACCESS crashes? This code will do what Jim says, so perhaps what you want to
do is different from this?

Can you give us more details?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top