S
Steven
I am using: Question is below the code:
Dim Wkbk As Workbook
Dim myFileName As String
Dim myPath As String
myPath = "C:\ThisDirectory\" '<- include that backslash!
myFileName = "File001.xls"
Set Wkbk = Nothing
On Error Resume Next
Set Wkbk = Workbooks(myFileName)
On Error GoTo 0
If Wkbk Is Nothing Then
'it's not open
Set Wkbk = Workbooks.Open(Filename:=myPath & myFileName, _
UpdateLinks:=False, ReadOnly:=False, Password:="aoaoao")
Wkbk.RunAutoMacros which:=xlAutoOpen
If Wkbk.HasPassword = False Then
Wkbk.Close savechanges:=False
MsgBox "Error occured in opening the file."
End If
Else
MsgBox "The file is already open!"
End If
My question is: Is there a way to get the value of cell "L1" form the Wkbk.
And also is there a way to change the value of cell "L1" in the Wkbk. And
do this within the flow of the macro. I would really like to do it using the
Workbook "Wkbk" method. If not possible, what is the method to do this?
Thank you,
Steven
Dim Wkbk As Workbook
Dim myFileName As String
Dim myPath As String
myPath = "C:\ThisDirectory\" '<- include that backslash!
myFileName = "File001.xls"
Set Wkbk = Nothing
On Error Resume Next
Set Wkbk = Workbooks(myFileName)
On Error GoTo 0
If Wkbk Is Nothing Then
'it's not open
Set Wkbk = Workbooks.Open(Filename:=myPath & myFileName, _
UpdateLinks:=False, ReadOnly:=False, Password:="aoaoao")
Wkbk.RunAutoMacros which:=xlAutoOpen
If Wkbk.HasPassword = False Then
Wkbk.Close savechanges:=False
MsgBox "Error occured in opening the file."
End If
Else
MsgBox "The file is already open!"
End If
My question is: Is there a way to get the value of cell "L1" form the Wkbk.
And also is there a way to change the value of cell "L1" in the Wkbk. And
do this within the flow of the macro. I would really like to do it using the
Workbook "Wkbk" method. If not possible, what is the method to do this?
Thank you,
Steven