View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Macro that opens a separate workbook to a specified worksheetwhen the active workbook is right mouse clicked

I like to keep it simple. Just recorded and edited this

Sub Macro4()
'
' Macro4 Macro
' Macro recorded 12/19/2011 by Donald B. Guillett
'

'
Workbooks.Open(Filename:= _
"C:\yourfoldername\yourfilename.xls", _
UpdateLinks:=3).RunAutoMacros Which:=xlAutoOpen
Sheets("yoursheetname").Select
Range("A12").Select
End Sub



On Dec 19, 12:53*pm, Michael Lanier wrote:
I have a macro that opens a separate workbook when I right mouse click
but I want it to open to a specified sheet named "Wizard". It opens
the workbook by reading the string text displayed in M373 (see below).

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
* * * * Dim VHM As Workbook
* * * * Set VHM = ActiveWorkbook
* * * * Dim exlApp As Excel.Application
* * * * Set exlApp = New Excel.Application
* * * * exlApp.Visible = True
* * * * exlApp.Workbooks.Open Worksheets("DataBase").Range("M373")
* * * * VHM.Activate
* * * * Cancel = True
End Sub

Thanks for any help you can offer.

Michael