What does
Do??Code:MyXL.Workbook(1).Activate
Printable View
What does
Do??Code:MyXL.Workbook(1).Activate
If you have 2 excel files open (workbooks), this code will mimmick the user clicking onto one of the excel workbook windows to select it so as they can start entering values into it's sheets.
so in other words....it doesnt solve my problem...dang!!!
As per another post...my problem is this...
The above code (plus other bits and pieces i have) opens excel and opens my specified file within it. What i want is for the user to edit the spreadsheet and then save it, however, you cannot edit the spreadsheet at all....you cant even click on another cell...its locked up!!!! You can however, use the excel file menu to close etc etcCode:MyXL.application.visible = true
MyXL.Windows(1).visible = True
Im wondering if the sheet i open isnt active???
matt
I think it's to do with the file itself - outside of the code/vb, can you open up the same Excel file in Excel itself & goto the Tools menu - there's a protection submenu 1/2 way down which should have a "Protect sheet" option there - if you can't see this, but see an "Un-Protect sheet" option, this means someone has added a password to restrict anyone from being able to edit & save the workbook on the actual file itself & I would contact the person who created the file to get them to remove this locking/protection ....
Ah, yeah - another thought, there is another way to set protection on an Excel file - if you open the same file up again from within Excel, then goto the Save as menu, you'll see an "advanced" button on the prompting save dialog box which appears, under this button/menu there's a "save options" or "general options" setting/submenu you can click where you can also set this restriction, again, remove this setting & re-save the file ...
Hi
Its not a protection issue...the excel file was created by me 2 mins before i did the file so theres no protection.
Also...when a file does have protection, you can normally view it as read only anyway and still edit it but have to save it under a different file name...
Matt
Okay, which one's your other post then, can you post the link for me please?Quote:
As per another post...my problem is this...
Code:Dim xclObject As New Excel.Application
Dim xclWorkBook As Excel.Workbook
Dim xclWorkSheet As Excel.Worksheet
Set xclWorkBook = xclObject.Workbooks.Open("c:\temp.xls")
Set xclWorkSheet = xclWorkBook.ActiveSheet
xclObject.Application.Visible = True
xclWorkSheet.Visible = xlSheetVisible
i did this and it was visible and i could edit it
To do what you're trying, only this is needed really, this will open up an excel file so the users can edit it - if this can't be edited, then it's definitley down to the file itself - maybe the read only flag is ticked on the file right click properties? Or maybe there is a piece of code running on the workbook_activate event which is disabling the editing?
Code:Private Sub Form_Load()
Dim xclObject As Excel.Application
Set xclObject = New Excel.Application
With xclObject
.Workbooks.Open ("c:\temp.xls")
.Workbooks(1).Worksheets(1).Select
.Visible = True
End With
End Sub