Ghost VBA Projects Created when using Hypelink

S

slim26

Hello,

I'm am having a difficult time with the following task.

I have 2 excel workbooks.

Book 1 has a hyperlink to open Book 2

Book 2 has the Workbook_Open macro below to force the file into Read-
Only mode.

The issue I'm having is whenever I launch Book 2 from the standard
hyperlink, I am getting multiple ghost projects of Book 2 opening up.
It will then screw up my entire Excel session from that point forward.

Any suggestions?

Thanks in advance.




Sub Workbook_open()

Application.ScreenUpdating = False

Dim strName, strPath, strCurrName As String

strName = ActiveWorkbook.Name
strPath = ActiveWorkbook.Path
strCurrName = strPath & "\" & strName

Workbooks.Open strCurrName, ReadOnly:=True

Application.ScreenUpdating = True

End Sub
 
J

Joel

Why would you want a workbook when it opens, open a workbook that is already
opened?

This macro makes no sense!!!
 
S

slim26

Why would you want a workbook when it opens, open a workbook that is already
opened?

This macro makes no sense!!!

Purpose of the macro is to force the file into readonly mode upon
opening. But I believe I see the error now. Thanks.
 
S

slim26

Purpose of the macro is to force the file into readonly mode upon
opening.  But I believe I see the error now.  Thanks.

I was using the wrong method to attempt to force file to open as
readonly.

All I simply needed was this:

Private Sub Workbook_open()
ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
End Sub
 

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