Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Really strange!! Switch/Open code fails occasionaly?!

Hi,

I have the following code to switch/open a workbook.

Private Sub CommandButton3_Click()
s = "file:///c:\My Documents\Pest Control Management System\Pest Control
Reporting Tool.xls"
ActiveWorkbook.FollowHyperlink Address:=s
Application.CommandBars("Web").Visible = False
End Sub

This is one two workbooks and the code is exactly the same (with the
exception of the file name). On one of the workbooks the code works, on the
other it does not. I get a messaging saying 'Object invalid or not found'

This is only (so far) happening on my husbands pc (windows vista excel
2003). The code works in both instances on my pc and the one at work.

Any ideas as this has me baffled (though thats not hard these days!)
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Really strange!! Switch/Open code fails occasionaly?!

I don't know much about Vista but I do know 2003. There are two forms for
webaddress that 2003 uses

1) s = "c:\dir1\sub1"
or
2) s = "//www.microsoft.com/sub1"


I don't think 2003 likes both the double slashes and the directory (c:).
"Leanne M (Aussie)" wrote:

Hi,

I have the following code to switch/open a workbook.

Private Sub CommandButton3_Click()
s = "file:///c:\My Documents\Pest Control Management System\Pest Control
Reporting Tool.xls"
ActiveWorkbook.FollowHyperlink Address:=s
Application.CommandBars("Web").Visible = False
End Sub

This is one two workbooks and the code is exactly the same (with the
exception of the file name). On one of the workbooks the code works, on the
other it does not. I get a messaging saying 'Object invalid or not found'

This is only (so far) happening on my husbands pc (windows vista excel
2003). The code works in both instances on my pc and the one at work.

Any ideas as this has me baffled (though thats not hard these days!)
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Really strange!! Switch/Open code fails occasionaly?!

Hi,

Thanks for this information.

If I understand you correctly, I should remove the

file:///

part of the code and then this should work each time.

The web command bar is just because for some reason it makes this visible
and I know my users will freak out when their screen changes! They know very
little about Excel - and computers for that mater!
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)


"Joel" wrote:

I don't know much about Vista but I do know 2003. There are two forms for
webaddress that 2003 uses

1) s = "c:\dir1\sub1"
or
2) s = "//www.microsoft.com/sub1"


I don't think 2003 likes both the double slashes and the directory (c:).
"Leanne M (Aussie)" wrote:

Hi,

I have the following code to switch/open a workbook.

Private Sub CommandButton3_Click()
s = "file:///c:\My Documents\Pest Control Management System\Pest Control
Reporting Tool.xls"
ActiveWorkbook.FollowHyperlink Address:=s
Application.CommandBars("Web").Visible = False
End Sub

This is one two workbooks and the code is exactly the same (with the
exception of the file name). On one of the workbooks the code works, on the
other it does not. I get a messaging saying 'Object invalid or not found'

This is only (so far) happening on my husbands pc (windows vista excel
2003). The code works in both instances on my pc and the one at work.

Any ideas as this has me baffled (though thats not hard these days!)
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Really strange!! Switch/Open code fails occasionaly?!

Just something to try...

I've always used:

file:////c:.....

(4 slashes

Leanne M (Aussie) wrote:

Hi,

I have the following code to switch/open a workbook.

Private Sub CommandButton3_Click()
s = "file:///c:\My Documents\Pest Control Management System\Pest Control
Reporting Tool.xls"
ActiveWorkbook.FollowHyperlink Address:=s
Application.CommandBars("Web").Visible = False
End Sub

This is one two workbooks and the code is exactly the same (with the
exception of the file name). On one of the workbooks the code works, on the
other it does not. I get a messaging saying 'Object invalid or not found'

This is only (so far) happening on my husbands pc (windows vista excel
2003). The code works in both instances on my pc and the one at work.

Any ideas as this has me baffled (though thats not hard these days!)
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Really strange!! Switch/Open code fails occasionaly?!

Ok I will give that a try also.
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)


"Dave Peterson" wrote:

Just something to try...

I've always used:

file:////c:.....

(4 slashes

Leanne M (Aussie) wrote:

Hi,

I have the following code to switch/open a workbook.

Private Sub CommandButton3_Click()
s = "file:///c:\My Documents\Pest Control Management System\Pest Control
Reporting Tool.xls"
ActiveWorkbook.FollowHyperlink Address:=s
Application.CommandBars("Web").Visible = False
End Sub

This is one two workbooks and the code is exactly the same (with the
exception of the file name). On one of the workbooks the code works, on the
other it does not. I get a messaging saying 'Object invalid or not found'

This is only (so far) happening on my husbands pc (windows vista excel
2003). The code works in both instances on my pc and the one at work.

Any ideas as this has me baffled (though thats not hard these days!)
--
Leanne M (Aussie)
(Changed Display name from Leanne)
United Kingdom
(Don''t ask me what an Aussie is doing living in the UK!)


--

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
Open or switch to a file Leanne M (Aussie) Excel Programming 11 May 1st 08 10:02 AM
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. san Excel Programming 1 January 3rd 06 03:22 AM
how do you switch from auto open Jay Excel Discussion (Misc queries) 3 July 18th 05 04:29 PM
Switch() causes strange ADO result onedaywhen[_2_] Excel Programming 10 December 13th 04 10:36 AM
Open Excel from VB using Read-Only switch? Ed[_18_] Excel Programming 2 May 13th 04 04:17 PM


All times are GMT +1. The time now is 02:37 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"