![]() |
shortcuts to excel files.
hi all.
i'm creating a system that works on the net. i'm writing it with asp and one of the functions of the system is to import data from excel files into the system (access db). everything is going swell, except one thing. whenever the system creates a new excel workbook and saves it as xls file something (i don't know what) is creating a shortcut to that file and places it in the system drive (c:\). the xls files that the system creates are only temp files and they are deleted after being used. the shortcuts remain. i can't figure out why this is happenning and i really want it to stop! i can't delete the shortcuts with asp because the system will be hosted on a server that has nothing to do with me and i have no idea if i'll have access to the system drive (probably not). i'm kind of stuck here. i would love to get any ideas of why this is happenning and how can i avoid it. thanks a lot! nitm; |
shortcuts to excel files.
Hi nitm,
How are you creating the Excel workbooks on the server? Using Server.CreateObject, using an HTML file upload, or some other way? How are you saving the file? If you can provide more detail (including relevant lines of code), that would make it much easier to diagnose. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: hi all. i'm creating a system that works on the net. i'm writing it with asp and one of the functions of the system is to import data from excel files into the system (access db). everything is going swell, except one thing. whenever the system creates a new excel workbook and saves it as xls file something (i don't know what) is creating a shortcut to that file and places it in the system drive (c:\). the xls files that the system creates are only temp files and they are deleted after being used. the shortcuts remain. i can't figure out why this is happenning and i really want it to stop! i can't delete the shortcuts with asp because the system will be hosted on a server that has nothing to do with me and i have no idea if i'll have access to the system drive (probably not). i'm kind of stuck here. i would love to get any ideas of why this is happenning and how can i avoid it. thanks a lot! nitm; |
well..
here are parts of the code that i think that have something to do with the
problem (you don't want to see the whole code): tmpfilename = "tmp_" & Int((99 - 10 + 1) * Rnd + 10) &"_" & Int((999 - 100 + 1) * Rnd + 100) & ".xls" objfso.CopyFile Server.MapPath("emplate.xls"), Server.MapPath(tmpfilename), true Dim objExcel, objWorkBook, objSheet Set objExcel = Server.CreateObject("Excel.Application") objExcel.Visible = False objExcel.DisplayAlerts = False Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) for each objSheet in objWorkBook.Sheets if InStr(1,tbls,"," & getTblNum(objSheet.Name) & ",") = 0 then objSheet.Delete end if next objWorkBook.Close True Set objWorkBook = Nothing objExcel.Quit Set objExcel = Nothing here's what i'm doing: there's a template file on da server (xls file) with some sheets in it. i copy this file and i'm giving it a random name so that if more than one user attempts this it won't crush. after that i iterate thru all of the sheets in the temp file and check if the user asked for the sheet, if not i delete the sheet from the temp file. that's the code that i just gave you, after that i send the temp file to the user and at the end i delete the file with the file system object (asp). hope this explains it all. thanks a lot. "Jake Marx" wrote: Hi nitm, How are you creating the Excel workbooks on the server? Using Server.CreateObject, using an HTML file upload, or some other way? How are you saving the file? If you can provide more detail (including relevant lines of code), that would make it much easier to diagnose. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: hi all. i'm creating a system that works on the net. i'm writing it with asp and one of the functions of the system is to import data from excel files into the system (access db). everything is going swell, except one thing. whenever the system creates a new excel workbook and saves it as xls file something (i don't know what) is creating a shortcut to that file and places it in the system drive (c:\). the xls files that the system creates are only temp files and they are deleted after being used. the shortcuts remain. i can't figure out why this is happenning and i really want it to stop! i can't delete the shortcuts with asp because the system will be hosted on a server that has nothing to do with me and i have no idea if i'll have access to the system drive (probably not). i'm kind of stuck here. i would love to get any ideas of why this is happenning and how can i avoid it. thanks a lot! nitm; |
well..
Hmm...I don't see anything there that would cause a shortcut to be created.
Where exactly is the shortcut to the XL file being created? In the root of C:? And it's a true shortcut, not a copy of the new XL file? -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: here are parts of the code that i think that have something to do with the problem (you don't want to see the whole code): tmpfilename = "tmp_" & Int((99 - 10 + 1) * Rnd + 10) &"_" & Int((999 - 100 + 1) * Rnd + 100) & ".xls" objfso.CopyFile Server.MapPath("emplate.xls"), Server.MapPath(tmpfilename), true Dim objExcel, objWorkBook, objSheet Set objExcel = Server.CreateObject("Excel.Application") objExcel.Visible = False objExcel.DisplayAlerts = False Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) for each objSheet in objWorkBook.Sheets if InStr(1,tbls,"," & getTblNum(objSheet.Name) & ",") = 0 then objSheet.Delete end if next objWorkBook.Close True Set objWorkBook = Nothing objExcel.Quit Set objExcel = Nothing here's what i'm doing: there's a template file on da server (xls file) with some sheets in it. i copy this file and i'm giving it a random name so that if more than one user attempts this it won't crush. after that i iterate thru all of the sheets in the temp file and check if the user asked for the sheet, if not i delete the sheet from the temp file. that's the code that i just gave you, after that i send the temp file to the user and at the end i delete the file with the file system object (asp). hope this explains it all. thanks a lot. "Jake Marx" wrote: Hi nitm, How are you creating the Excel workbooks on the server? Using Server.CreateObject, using an HTML file upload, or some other way? How are you saving the file? If you can provide more detail (including relevant lines of code), that would make it much easier to diagnose. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: hi all. i'm creating a system that works on the net. i'm writing it with asp and one of the functions of the system is to import data from excel files into the system (access db). everything is going swell, except one thing. whenever the system creates a new excel workbook and saves it as xls file something (i don't know what) is creating a shortcut to that file and places it in the system drive (c:\). the xls files that the system creates are only temp files and they are deleted after being used. the shortcuts remain. i can't figure out why this is happenning and i really want it to stop! i can't delete the shortcuts with asp because the system will be hosted on a server that has nothing to do with me and i have no idea if i'll have access to the system drive (probably not). i'm kind of stuck here. i would love to get any ideas of why this is happenning and how can i avoid it. thanks a lot! nitm; |
yup.
i don't see that either.
yes, the shortctus are being created in the root of the system drive (it's d: in my machine but c: in the server which i tested it on). and yes, it's a true shortcut, not a copy of the xls file. i see only two options for which lines are the ones that causing it: (1) Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) (2) objWorkBook.Close True these are the only ones that looks like they might do something stupid enough... thanks. "Jake Marx" wrote: Hmm...I don't see anything there that would cause a shortcut to be created. Where exactly is the shortcut to the XL file being created? In the root of C:? And it's a true shortcut, not a copy of the new XL file? -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: here are parts of the code that i think that have something to do with the problem (you don't want to see the whole code): tmpfilename = "tmp_" & Int((99 - 10 + 1) * Rnd + 10) &"_" & Int((999 - 100 + 1) * Rnd + 100) & ".xls" objfso.CopyFile Server.MapPath("emplate.xls"), Server.MapPath(tmpfilename), true Dim objExcel, objWorkBook, objSheet Set objExcel = Server.CreateObject("Excel.Application") objExcel.Visible = False objExcel.DisplayAlerts = False Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) for each objSheet in objWorkBook.Sheets if InStr(1,tbls,"," & getTblNum(objSheet.Name) & ",") = 0 then objSheet.Delete end if next objWorkBook.Close True Set objWorkBook = Nothing objExcel.Quit Set objExcel = Nothing here's what i'm doing: there's a template file on da server (xls file) with some sheets in it. i copy this file and i'm giving it a random name so that if more than one user attempts this it won't crush. after that i iterate thru all of the sheets in the temp file and check if the user asked for the sheet, if not i delete the sheet from the temp file. that's the code that i just gave you, after that i send the temp file to the user and at the end i delete the file with the file system object (asp). hope this explains it all. thanks a lot. "Jake Marx" wrote: Hi nitm, How are you creating the Excel workbooks on the server? Using Server.CreateObject, using an HTML file upload, or some other way? How are you saving the file? If you can provide more detail (including relevant lines of code), that would make it much easier to diagnose. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: hi all. i'm creating a system that works on the net. i'm writing it with asp and one of the functions of the system is to import data from excel files into the system (access db). everything is going swell, except one thing. whenever the system creates a new excel workbook and saves it as xls file something (i don't know what) is creating a shortcut to that file and places it in the system drive (c:\). the xls files that the system creates are only temp files and they are deleted after being used. the shortcuts remain. i can't figure out why this is happenning and i really want it to stop! i can't delete the shortcuts with asp because the system will be hosted on a server that has nothing to do with me and i have no idea if i'll have access to the system drive (probably not). i'm kind of stuck here. i would love to get any ideas of why this is happenning and how can i avoid it. thanks a lot! nitm; |
yup.
nitm wrote:
i don't see that either. yes, the shortctus are being created in the root of the system drive (it's d: in my machine but c: in the server which i tested it on). and yes, it's a true shortcut, not a copy of the xls file. So this happens on your development machine as well? i see only two options for which lines are the ones that causing it: (1) Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) (2) objWorkBook.Close True Errors in Automating Excel can definitely cause problems, but mostly with Excel processes hanging around after you meant to close them. I've never seen shortcuts created willy-nilly like this. Have you determined at what point in the process the shortcut actually shows up in the C:\ folder? -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
yup.
hi jake.
first of all i'd like to thank you for your help, so thanks. yes, this problem occurs in my machine (windows 2000 proffesional s.p 4 + iis) and on the server in my working place. i asked around the asp forum where i usually go to (4guys from rolla) and someone said he has the same problem, but he isn't even using asp, just clicks on a file. here's the url for my thread the http://www.aspmessageboard.com/forum...=20&P=1#759859 i don't have that problem though, if i double click on a file it only opens it w/out creating a shortcut. it happens only with the asp. Errors in Automating Excel can definitely cause problems, but mostly with Excel processes hanging around after you meant to close them. I've never seen shortcuts created willy-nilly like this. i had that problem (when the excel just hangs) but i fixed that.. there are no errors now, it all goes great.. works just as i want it to... i don't think it has something to do with errors... Have you determined at what point in the process the shortcut actually shows up in the C:\ folder? like i said, i think that it's one of these code lines: (1) Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) (2) objWorkBook.Close True but i'm not sure, do you have any idea of how can i know for sure? thanks, nitm; |
yup.
nitm wrote:
Have you determined at what point in the process the shortcut actually shows up in the C:\ folder? like i said, i think that it's one of these code lines: (1) Set objWorkBook = objExcel.Workbooks.Open(Server.MapPath(mpfilename) ) (2) objWorkBook.Close True but i'm not sure, do you have any idea of how can i know for sure? Well, I would probably put a Response.End at various places in my ASP server-side code to see exactly which line of code is creating the shortcut. I have found a few other postings from users experiencing the same problem, and one user said it was happening on the Workbooks.Open line. Are the web servers running IIS, and if so, is URLScan or IIS Lockdown installed on either/both? One other thing - is Option Explicit at the top of your ASP document? If not, add it and make sure you aren't using any undeclared variables. I noticed you use mpfilename in the code above but tmpfilename earlier - just curious to know if that is intentional or a typo. Option Explicit will tell you for sure. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
yup.
Well, I would probably put a Response.End at various places in my ASP
server-side code to see exactly which line of code is creating the shortcut. I have found a few other postings from users experiencing the same problem, and one user said it was happening on the Workbooks.Open line. good idea, why didn't i think of that? that user was right, it happens after the Workbook.Open method. Are the web servers running IIS, and if so, is URLScan or IIS Lockdown installed on either/both? yes, both my computer & the server are running IIS, i don't know what URLScan or IIS Lockdown are... i don't think that it's installed on my computer (i didn't install it) and i have no idea if the server has them. what are they? should i install them? One other thing - is Option Explicit at the top of your ASP document? If not, add it and make sure you aren't using any undeclared variables. I noticed you use mpfilename in the code above but tmpfilename earlier - just curious to know if that is intentional or a typo. Option Explicit will tell you for sure. yes, i use Option Explicit, always. there's no mpfilename, it's tmpfilename but i guess i deleted the 't' when i copied the code.. sorry for that. i take it that you only found that this problem happenned to other people but there was no answer to the problem.... thanks again. nitzan; |
yup.
nitm wrote:
Are the web servers running IIS, and if so, is URLScan or IIS Lockdown installed on either/both? yes, both my computer & the server are running IIS, i don't know what URLScan or IIS Lockdown are... i don't think that it's installed on my computer (i didn't install it) and i have no idea if the server has them. what are they? should i install them? Well, they're a good idea to have running if you have a publicly-accessible IIS machine. They are designed to stop certain URL-based attacks and prevent certain types of files from executing on the server. I was just checking because they can cause unexpected results with certain scripts/file types. I doubt this is the case here since you didn't install them. One other thing - is Option Explicit at the top of your ASP document? If not, add it and make sure you aren't using any undeclared variables. I noticed you use mpfilename in the code above but tmpfilename earlier - just curious to know if that is intentional or a typo. Option Explicit will tell you for sure. yes, i use Option Explicit, always. there's no mpfilename, it's tmpfilename but i guess i deleted the 't' when i copied the code.. sorry for that. No problem - just checking. <g i take it that you only found that this problem happenned to other people but there was no answer to the problem.... Yes. You may want to try your luck in one of the ASP or IIS groups to see if anyone knows what's going on. Sorry I couldn't be of more assistance. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
yup.
hi jake,
thank you for your help, i will check it in the iis and asp groups. can you please send me the urls to where you found about other people with my problem. thanks, nitzan. |
yup.
http://forums.devshed.com/showthread...oto=nextoldest
http://groups-beta.google.com/group/...82dfa9246afcf8 http://groups-beta.google.com/group/...9b3878248d878c http://groups-beta.google.com/group/...33e629befb5237 -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] nitm wrote: hi jake, thank you for your help, i will check it in the iis and asp groups. can you please send me the urls to where you found about other people with my problem. thanks, nitzan. |
All times are GMT +1. The time now is 09:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com