ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Ghost VBA Projects Created when using Hypelink (https://www.excelbanter.com/excel-programming/436291-ghost-vba-projects-created-when-using-hypelink.html)

slim26

Ghost VBA Projects Created when using Hypelink
 
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

joel

Ghost VBA Projects Created when using Hypelink
 
Why would you want a workbook when it opens, open a workbook that is already
opened?

This macro makes no sense!!!

"slim26" wrote:

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
.


slim26

Ghost VBA Projects Created when using Hypelink
 
On Nov 18, 6:09*am, Joel wrote:
Why would you want a workbook when it opens, open a workbook that is already
opened?

This macro makes no sense!!!

"slim26" wrote:
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
.


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

slim26

Ghost VBA Projects Created when using Hypelink
 
On Nov 18, 9:08*am, slim26 wrote:
On Nov 18, 6:09*am, Joel wrote:



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


This macro makes no sense!!!


"slim26" wrote:
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
.


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






All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com