pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Sorry I have to restart part of my old thread.
Could someone please edit this part or the whole code..
I want myself to enter the whole path myself like 'C\Macro and Excels trix\.. etc and not "thisworkbook.path & \book2.xls"
Thanks pedie
Could someone please edit this part or the whole code..
Code:
MyFile = [COLOR=red]ThisWorkbook.Path & "\Book2.xls"[/COLOR]
Thanks pedie
Code:
Sub Test2()
Dim wb As Workbook, MyFile As String
MyFile = [COLOR=red]ThisWorkbook.Path & "\Book2.xls"[/COLOR]
On Error Resume Next
Set wb = Workbooks.Open(Filename:=MyFile)
On Error GoTo 0
If wb Is Nothing Then MsgBox "Couldn't locate " & MyFile: Exit Sub
With wb
'.Activate
'.Cells.Activate
With ActiveSheet
.Range("A1").Value = "Hello!"
.Range("A3").Formula = "=A1"
End With
.Save
.Close
End With
End Sub