Originally Posted by
maryam
I have this coding, but still get the error. I need to open another workbook which is Data1 when the first workbook opens.
[vba] Private Sub Workbook_Open()
Dim PathName As String
'All irrelevant toolbars are hidden
Run HideAllToolBars
Application.ScreenUpdating = False
PathName = Application.ThisWorkbook.Path & "\Data1.xls"
Workbooks.Open (PathName)
ActiveWindow.Visible = True
Application.ScreenUpdating = True
'Sub AssignMacros()
With Application.CommandBars("Object Palette1")
With .Controls("&Cancel Choice")
.OnAction = "BreakChoice"
End With
With .Controls("&Connector")
.OnAction = "AddConnector"
End With
With .Controls("&Material Stream")
.OnAction = "AddStreams"
End With
.
.
.
End Sub[/vba]