+ Reply to Thread
Results 1 to 12 of 12

Sheet activation working fine for me, but not for others?

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Sheet activation working fine for me, but not for others?

    I've got a bit of a macro that opens a second workbook, copies its contents, pastes it into the workbook from which the macro was run, then closes the workbook that was opened.

    Please Login or Register  to view this content.
    This all runs fine on my own PC, but at the starred activation line it errors out for others on our LAN. Any inclination as to why that may be, or alternatively would there be a good way to perform this copy without opening or activating the sourceofcopy.xlsx workbook? The aim is simply to copy the entire contents of a single worksheet to the open workbook for analysis. VBA is definitely not my line of work, so please have patience with the newb!
    Last edited by seed; 07-25-2013 at 03:59 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Sheet activation working fine for me, but not for others?

    Hi seed and welcome to the forum,

    Without seeing your machine or others on the net, I'd expect you have a local copy of the file and it can find and open it while others don't have a local copy of that .xlsx file. Perhaps you need to put a path in front of the location of that file and stick it on your net somewhere. Then when others (and you also) try to open it, it will search on the net instead of your local machine.

    My answer is a simple guess. Without being on your net or seeing your machine and local files, I'm not sure it my suggestion is even close.

    Something like this?? http://excelexperts.com/VBA-Tips-Get-A-File-Path
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sheet activation working fine for me, but not for others?

    Sorry - There is a path to the file, which is located on our company's LAN. The line actually reads

    Please Login or Register  to view this content.
    Just to be sure, I'll go ahead and write a tiny macro to simply open the file and see if that works for them, then get back to report the result. I would think that if the path to the file was the problem, though, that it would have errored out at that workbooks.open line rather than the windows.activate line? I wish I had more time to learn all this stuff...

    Thank you for your reply.
    Last edited by seed; 07-25-2013 at 03:59 PM.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Sheet activation working fine for me, but not for others?

    Perhaps you need to do a
    application.workbooks("sourceofcopy.xlsx").Activate
    instead of your
    Windows("sourceofcopy.xlsx").Activate

  5. #5
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sheet activation working fine for me, but not for others?

    Nope, your first guess was evidently correct. Something wrong with the path. I'll take a good hard look into that. The same path pasted into a start menu search brings it right up, both here and at the 2nd location.

    Thank you for your help.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Sheet activation working fine for me, but not for others?

    In the VBA immediate window do these two commands
    application.FindFile
    ?application.ActiveWorkbook.path

    The Application.FindFile will open a dialog and allow you to look for the file. When you find it and press enter it will open that file. Then the
    ?Application.ActiveWorkbook.Path will do a Debug.Print (?) of the path to where that sucker is.

    Is there a chance others on the net have their drive maps different than yours? Some may have a directory mapped as F: while others G: or K:? That is the old Novell method. You should do the above on their machines to see where they think the file is located on the net.
    Last edited by MarvinP; 07-26-2013 at 02:11 AM.

  7. #7
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sheet activation working fine for me, but not for others?

    Tried that and it gives the drive letter/folder

    I am not using a drive letter - learned that early on in working with VBA. It is to the tune of \\companyaddress.com\serverlocation\sharedLANdirectory\folder\filename.xlsx

    That path works at all locations when stuck into internet explorer or entered into the start menu search bar, but for some reason doesn't work within VBA except from my PC.

    Thanks again (feeling repetitive with the "thanks")

  8. #8
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sheet activation working fine for me, but not for others?

    And I just got word that a third location had no trouble at all... Will now investigate to see if it's a permissions issue on what I thought was a completely open drive. One final thanks, MarvinP.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Sheet activation working fine for me, but not for others?

    Could the problem be that some people have Windows set to display file extensions and other's don't?

    By the way, the code could be tidied up a bit.
    Please Login or Register  to view this content.
    Actually that might help with the original problem because it doesn't involve referring to workbooks with their names.
    If posting code please use code tags, see here.

  10. #10
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sheet activation working fine for me, but not for others?

    I have zero doubts that my code is ugly as sin - I figure pretty code is a luxury reserved for the educated!

    Rewritten using your code, which again works great here at my PC. Waiting to hear whether it works elsewhere.

    Never would have imagined that simply displaying file extensions would have made a difference. Excellent to know.

    Thanks Norie.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Sheet activation working fine for me, but not for others?

    seed

    You would think it wouldn't matter but it sometimes does.
    Last edited by Norie; 07-25-2013 at 04:10 PM.

  12. #12
    Registered User
    Join Date
    07-25-2013
    Location
    Iowa
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Sheet activation working fine for me, but not for others?

    Quote Originally Posted by Norie View Post
    Could the problem be that some people have Windows set to display file extensions and other's don't?

    Please Login or Register  to view this content.
    This appears to work wonderfully. Many thanks to you both. Don't know what I'd do if there weren't generous folks such as yourselves around to hold my hand and lead me through getting this stuff to work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Goal Seek not working on 1 PC but works fine on another?
    By jennymc in forum Excel General
    Replies: 7
    Last Post: 07-11-2013, 10:49 AM
  2. [SOLVED] Two VBA Functions working fine with Win XP but not working with Win 7
    By LoveCandle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-01-2013, 04:01 PM
  3. [SOLVED] Macro to highlight keywords-Macrobutton not working fine
    By Awalgaonkar in forum Word Formatting & General
    Replies: 2
    Last Post: 03-27-2013, 08:03 AM
  4. [SOLVED] hi i have formula it's working fine but i want to Automatically run macros at Specified.
    By vikas2424 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-14-2012, 01:21 PM
  5. Minimise/maximise Modeless Userform on activation/de-activation
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2009, 11:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1