Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista HP + Excel 2003 code = Lost VB Project Mac Excel Programming 1 March 2nd 09 01:03 PM
code for auto numbering documents des-sa[_2_] Excel Discussion (Misc queries) 1 August 19th 08 12:50 PM
code to navigate IE7 runs on XP but not on Vista Ed Vogel Excel Programming 2 August 12th 08 03:56 PM
code to extract data from a website runs of XP but not Vista Russ Excel Programming 1 May 16th 08 01:30 AM
Code to view and Print several documents sky Excel Programming 0 November 9th 05 05:50 PM


All times are GMT +1. The time now is 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"