Hi Cetin
I got it finally working. After trying many options I finally concluded that it is the GetObject() function which makes the worksheet hidden. The next code (99.99% yours) works great an fast also.
lcFileName = GetFile('xls')
oExcel= createobject('Excel.application')
with oExcel
.WorkBooks.open(lcFileName)
.Workbooks(1).ActiveSheet.Range("A:D").EntireColumn.AutoFit
.WorkBooks(1).Save
.Quit
endwith
Bu the next one, instead of using CreateObject, in contains a GetObject() keeps the file hidden next time you try to open it.
lcFile = GetFile('xls')
uTMP = GetObject(lcFile)
oXLSApp = uTMP.application
with oXLSApp
.Workbooks(1).ActiveSheet.Range("A:D").EntireColumn.AutoFit
.workbooks(1).Save
.Quit
endwith
If you ever try GetObject and manage to make it work without hiding the worksheet, please let me know. All I got from a debug session was that when you un-hide the worksheet from within Excel, the Saved property changes but I couldn’t notice any other property changed, so it probably changes any other object inside the application, or a property of the application object.
Regards and thanks again
Oscar
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only