View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
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