Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code seeing documents in Vista?
Hello,
I created an Excel application using Office 2003 and on Windows XP. During the project, I had to upgrade to Office 2007 and Windows Vista. I noticed that my macros were not able to see the files (myfile.xls). My client laughed and said I ought to look into how Vista hides the extensions on files. I went to tools options on the folder and said show extensions. MY VBA code was then able to see the document. Has anyone else experienced this? How can we write code that can see documents whether or not the folder has extensions hidden or visible? Thanks, Tony |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code seeing documents in Vista?
This not just a Vista/xl2007 problem.
It's been a problem for as long as I can recall. In your code, I bet you do something like: workbooks("myfile").worksheets("Sheet1").range("a1 ").value = "ok" Depending on that windows setting (show or hide extensions), this type of code would cause problems--as you've seen. But if you use code like: workbooks("myfile.xls").worksheets("Sheet1").range ("a1").value = "ok" The code will work no matter what that setting is. So I'm saying that you were lucky in your earlier life <vbg. Webtechie wrote: Hello, I created an Excel application using Office 2003 and on Windows XP. During the project, I had to upgrade to Office 2007 and Windows Vista. I noticed that my macros were not able to see the files (myfile.xls). My client laughed and said I ought to look into how Vista hides the extensions on files. I went to tools options on the folder and said show extensions. MY VBA code was then able to see the document. Has anyone else experienced this? How can we write code that can see documents whether or not the folder has extensions hidden or visible? Thanks, Tony -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code seeing documents in Vista?
Hiding extensions in nothing new in Vista. I think it is a very bad
idea because when a user sees a file name, he is used to seeing the extension or at least thinks it is normal behavior to see it. E.g., GroceryList.txt He assumes this file, like all txt files,,txt is safe to open, correctly so. However, if extensions are hidden, the file named GroceryList.txt.exe could be a program that does all sorts of nefarious things. The file name, though, is displayed as GroceryList.txt, which appears to be a harmless text file. Finding out whether extensions are hidden or visible is not a simple task. However, I have code on my web site to do exactly that. See www.cpearson.com/Excel/FileExtensions.aspx . On that page you can download a zip file containing a bas file with all the code and API declares to see if extensions are hidden or visible. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Mon, 13 Apr 2009 07:15:02 -0700, Wretched wrote: Hello, I created an Excel application using Office 2003 and on Windows XP. During the project, I had to upgrade to Office 2007 and Windows Vista. I noticed that my macros were not able to see the files (myfile.xls). My client laughed and said I ought to look into how Vista hides the extensions on files. I went to tools options on the folder and said show extensions. MY VBA code was then able to see the document. Has anyone else experienced this? How can we write code that can see documents whether or not the folder has extensions hidden or visible? Thanks, Tony |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code seeing documents in Vista?
Dave,
I know a little more about programming than that. Actually my code was calling myfile.xls. With the extensions hidden, it couldn't find the file. When I unhid the extensions, the the VBA code worked fine. Tony "Dave Peterson" wrote: This not just a Vista/xl2007 problem. It's been a problem for as long as I can recall. In your code, I bet you do something like: workbooks("myfile").worksheets("Sheet1").range("a1 ").value = "ok" Depending on that windows setting (show or hide extensions), this type of code would cause problems--as you've seen. But if you use code like: workbooks("myfile.xls").worksheets("Sheet1").range ("a1").value = "ok" The code will work no matter what that setting is. So I'm saying that you were lucky in your earlier life <vbg. Webtechie wrote: Hello, I created an Excel application using Office 2003 and on Windows XP. During the project, I had to upgrade to Office 2007 and Windows Vista. I noticed that my macros were not able to see the files (myfile.xls). My client laughed and said I ought to look into how Vista hides the extensions on files. I went to tools options on the folder and said show extensions. MY VBA code was then able to see the document. Has anyone else experienced this? How can we write code that can see documents whether or not the folder has extensions hidden or visible? Thanks, Tony -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code seeing documents in Vista?
Chip,
Thanks for the reference to your site. It is a very good site. Thanks. But in my scenario of my set an object to a file and then opening it, how would using the caption work for me? Dim sh as sheet Dim wb as workbook set wb = workbooks("myfile.xls") set sh = wb.sheets("Sheet1") The above will error on me at set wb if the extensions are hidden. The variable wb is not set with the value "myfile.xls". Would I change the code to the caption? As in: set wb = workbooks(myCaption) Thanks a lot of explaining this to me. "Chip Pearson" wrote: Hiding extensions in nothing new in Vista. I think it is a very bad idea because when a user sees a file name, he is used to seeing the extension or at least thinks it is normal behavior to see it. E.g., GroceryList.txt He assumes this file, like all txt files,,txt is safe to open, correctly so. However, if extensions are hidden, the file named GroceryList.txt.exe could be a program that does all sorts of nefarious things. The file name, though, is displayed as GroceryList.txt, which appears to be a harmless text file. Finding out whether extensions are hidden or visible is not a simple task. However, I have code on my web site to do exactly that. See www.cpearson.com/Excel/FileExtensions.aspx . On that page you can download a zip file containing a bas file with all the code and API declares to see if extensions are hidden or visible. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Mon, 13 Apr 2009 07:15:02 -0700, Wretched wrote: Hello, I created an Excel application using Office 2003 and on Windows XP. During the project, I had to upgrade to Office 2007 and Windows Vista. I noticed that my macros were not able to see the files (myfile.xls). My client laughed and said I ought to look into how Vista hides the extensions on files. I went to tools options on the folder and said show extensions. MY VBA code was then able to see the document. Has anyone else experienced this? How can we write code that can see documents whether or not the folder has extensions hidden or visible? Thanks, Tony |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code seeing documents in Vista?
ok.
Webtechie wrote: Dave, I know a little more about programming than that. Actually my code was calling myfile.xls. With the extensions hidden, it couldn't find the file. When I unhid the extensions, the the VBA code worked fine. Tony "Dave Peterson" wrote: This not just a Vista/xl2007 problem. It's been a problem for as long as I can recall. In your code, I bet you do something like: workbooks("myfile").worksheets("Sheet1").range("a1 ").value = "ok" Depending on that windows setting (show or hide extensions), this type of code would cause problems--as you've seen. But if you use code like: workbooks("myfile.xls").worksheets("Sheet1").range ("a1").value = "ok" The code will work no matter what that setting is. So I'm saying that you were lucky in your earlier life <vbg. Webtechie wrote: Hello, I created an Excel application using Office 2003 and on Windows XP. During the project, I had to upgrade to Office 2007 and Windows Vista. I noticed that my macros were not able to see the files (myfile.xls). My client laughed and said I ought to look into how Vista hides the extensions on files. I went to tools options on the folder and said show extensions. MY VBA code was then able to see the document. Has anyone else experienced this? How can we write code that can see documents whether or not the folder has extensions hidden or visible? Thanks, Tony -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Vista HP + Excel 2003 code = Lost VB Project | Excel Programming | |||
code for auto numbering documents | Excel Discussion (Misc queries) | |||
code to navigate IE7 runs on XP but not on Vista | Excel Programming | |||
code to extract data from a website runs of XP but not Vista | Excel Programming | |||
Code to view and Print several documents | Excel Programming |