Thanks for the info. I checked the properties of the file and confirmed that
it is not set to "read only". Here is the sample code I am using for testing
purposes. I am greatly interested in getting this code to work because I
have different excel files located in directories and some of the directory
names contain spaces and the "Shell" function does not deal well with the
spaces in the directory names. I am passing variables to the directory
location based on the user input, that is why I declared the file location
as a string. Thanks in advance for your help.
Private Sub Command0_Click()
Dim xlx As Object, xlw As Object, xls As Object, xlc As Object
Dim strLoc As String
strLoc = "C:\Downloads\excel test\book1.xls"
Set xlx = CreateObject("Excel.Application")
xlx.Visible = True
Set xlw = xlx.Workbooks.Open(strLoc)
Set xls = xlw.Worksheets("test2")
Set xlc = xls.Range("A1")
' put code here to write into the cells etc.
' .
' .
' .
'Set xlc = Nothing
'Set xls = Nothing
'xlw.Save
'xlw.Close False
'Set xlw = Nothing
'xlx.Quit
'Set xlx = Nothing
End Sub