+ Reply to Thread
Results 1 to 5 of 5

Error In macro that checks if the file is already open

  1. #1
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Error In macro that checks if the file is already open

    Hi everyone - - - I thought that I had this working completely, but the test to see if the "file is already open" isn't working.

    Something is wrong with my example.

    I have marked in the code where the problem is. Everything else works.
    It's marked as such:


    HERE IS MY PROBLEM - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Can someone please tell me what I'm doing wrong ?

    Please Login or Register  to view this content.
    Please take note: The path and file name constantly change.



    The following Function IS CALLED to check if the File Is Open - or Not

    'It all works if the Path & File Name are hard coded. I have to have it working with changing Paths & File names.

    Please Login or Register  to view this content.
    Last edited by Launchnet; 03-27-2009 at 09:24 AM.
    Thanks for helping . . .
    Matt @ Launchnet

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Error In macro that checks if the file is already open

    Hi

    Here's another approach. You only need to enter the file name, not the path

    Please Login or Register  to view this content.
    called like

    Please Login or Register  to view this content.
    rylo

  3. #3
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: Error In macro that checks if the file is already open

    Hi rylo . . .
    Good to hear from you again.

    As I see it, the function isn't my problem. The function works properly, it simply isn't getting the Path and File name from the 1st macro.

    I should also have mentioned, that each file name is in a separate instance of Excel.

    I also want, if possible, that this should also work from a macro that opens a word document, checking to see if document is already open. Maybe I may have to use a second function when opening a word document which would be OK ????

  4. #4
    Forum Contributor
    Join Date
    03-25-2008
    MS-Off Ver
    Excel, Outlook, Word 2007/2003
    Posts
    245

    Re: Error In macro that checks if the file is already open

    You aren't passing the value of a variable to your function but the value cl. Maybe try this :
    Please Login or Register  to view this content.
    A little example to show the difference in passing the contents of a variable (declared as string) or a string

    Please Login or Register  to view this content.
    Charlize
    Last edited by Charlize; 03-27-2009 at 06:41 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    Re: Error In macro that checks if the file is already open

    Hi Charlize . . .

    You Charlized it. Works perfect for both Excel and Word.

    Have a great one.

    I'll post as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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