My Assistant
![]() ![]() |
|
|
Dec 1 2004, 12:42 PM
Post
#1
|
|
|
UtterAccess Addict Posts: 249 From: Los Angeles, CA |
Hello,
I'm using Access to automate Excel. When the spreadsheet is opened it opens Read Only, but I have the read only argument set to false. Does anyone have semi-logical explanation or work-around for this. Thanks Set xll = CreateObject("Excel.application") xll.Application.IgnoreRemoteRequests = True Set PandLBook = xll.Workbooks.Open(Form_frmUpdateDetailPLExcel.txtFileAndPath, False, False) |
|
|
|
Dec 1 2004, 01:57 PM
Post
#2
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Could be you don't have a command that closes the workbook in your code.
If you didn't set the 'xll' instance of Excel to visible, you may not notice that the workbook is still open. If you attempt to open the workbook for a second time, it opens as read-only. Post the whole code so that we can see (IMG:http://www.utteraccess.com/forum/style_emoticons/default/wink.gif) Martin |
|
|
|
Dec 1 2004, 02:14 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 249 From: Los Angeles, CA |
Thanks Martin,
Here is the end bit. I'll spare you the rest of it as it is several pages worth. Actually I've been playing with it and I think the problem lies here. PandLBook.Save PandLBook.Close False xll.Application.ScreenUpdating = True xll.Application.IgnoreRemoteRequests = False |
|
|
|
Dec 1 2004, 02:30 PM
Post
#4
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hmmm,
your end bit seems to be OK. You should Set PandLBook = Nothing but it doesn't change a thing here. Doesn't something apply from here ? |
|
|
|
Dec 1 2004, 02:50 PM
Post
#5
|
|
|
UtterAccess Addict Posts: 249 From: Los Angeles, CA |
Thanks,
I am releasing my variables, I just left it off my post. I checked you link, but nothing there seemed to help. I can open the file manually and it does not come up Read Only. PandLBook.Save PandLBook.Close False xll.Application.ScreenUpdating = True xll.Application.IgnoreRemoteRequests = False Set shData = Nothing Set PandLBook = Nothing xll.Application.Quit Set xll = Nothing |
|
|
|
Dec 1 2004, 02:58 PM
Post
#6
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
I am sorry but I don't know then :(
I was pretty sure you had an invisible instance of the workbook open. If you restart Windows and run the code, does the workbook open as read-only again? |
|
|
|
Dec 1 2004, 04:14 PM
Post
#7
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hello again,
two more things: If xll is the pointer to Application object, you don't need to use xll.Application. It's the same as if you'd use 'Application.Application' from within Excel. But mainly, I spotted the use of IgnoreRemoteRequests. Does this mean you use DDE? But the code snippet looks rather like an automation (IMG:http://www.utteraccess.com/forum/style_emoticons/default/confused.gif) Check this: http://msdn.microsoft.com/library/en-us/of...DETerminate.asp Martin |
|
|
|
Dec 1 2004, 04:41 PM
Post
#8
|
|
|
UtterAccess Addict Posts: 249 From: Los Angeles, CA |
Hello Martin,
I found the problem: I have a set of small function that runs before the code you've seen that does things like check if the file exist, if the file is open and if a certain query has data in it. Well, whomever wrote the part to check if the file is open (that would be me) never closes the file. So you were right when you said that the workbook may be open. Thanks. Now why can't I just teleport you or Nate here when I need some help? Thanks again |
|
|
|
Dec 1 2004, 04:47 PM
Post
#9
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
QUOTE Now why can't I just teleport you or Nate here when I need some help? No no, I'd be afraid. Did you see 'THE FLY'? (IMG:http://www.utteraccess.com/forum/style_emoticons/default/laugh.gif) You're welcome (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) martin |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th June 2013 - 06:47 AM |