Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unhide Excel File 1

Status
Not open for further replies.

aw23

Programmer
Nov 26, 2003
544
IL
I have a form with a button. When the user clicks on the button I'd like an Excel file to open (so that the user can add or remove data to the file which is totaly seperate from the Access application). The following is my code:
Code:
Private Sub cmdDateBook_Click()
Dim xlTmp As Excel.Application
Dim wb As workBook
Dim filePath As String
filePath = "ThePath"
Set xlTmp = New Excel.Application
Set wb = xlTmp.Workbooks.Open(filePath)

End Sub

When I run this code I get no error and it looks like it's doing something. But I never see Excel open. If I check the processes Excel is running. So apparantly it's opening but the user can't see it. How can I unhide it?

Thanks
 
Add this line:
xlTmp.Visible = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks, one more question. The file is read only. How can I allow users to write to it too?

Thanks
 
Maybe like this:
Set xlTmp = New Excel.Application
xlTmp.Visible = True
SetAttr filePath, vbNormal
Set wb = xlTmp.Workbooks.Open(filePath)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yay! That worked, thanks so much.
Can you please explain it?
 
SetAttr is a VBA instruction for changing file attributes.
Feel free to press the F1 key when the cursor is inside this word in your code.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top