+ Reply to Thread
Results 1 to 9 of 9

Rum macro only in my pc

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,078

    Rum macro only in my pc

    HI, Everyone
    i am using a code below to user Username of my pc

    Please Login or Register  to view this content.
    its working fine

    but i want to use a folder name with path, if folder exist with specific path then run the otherwise exit sub

    thanx a lot
    Use Code-Tags for showing your code :
    Please mark your question Solved if there has been offered a solution that works fine for you
    If You like solutions provided by anyone, feel free to add reputation using STAR *

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

    Re: Rum macro only in my pc

    Hi Sid,

    Why not use:

    If Environ("Path")*<> ... then Exit Sub

    To find the "..." go to*your immediate window and type:
    Debug.Print Environ("Path") and press*Enter.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,078

    Re: Rum macro only in my pc

    Sorry Forum Guru
    not understand

  4. #4
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Rum macro only in my pc

    Quote Originally Posted by MarvinP View Post
    Hi Sid,

    Why not use:

    If Environ("Path")*<> ... then Exit Sub

    To find the "..." go to*your immediate window and type:
    Debug.Print Environ("Path") and press*Enter.
    insert a new module and paste Guru's code like this
    Please Login or Register  to view this content.
    and run with the immediate window opened
    you will get path then in the begging of your macro( that needs to be run only on your pc) type
    If Environ("Path")*<> "your found path here " then exit sub
    else

    run your macro
    Teach me Excel VBA

  5. #5
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Rum macro only in my pc

    I was going to start a thread same like this but thanks haroon you did it

  6. #6
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,078

    Re: Rum macro only in my pc

    nope
    its not working

    i have a folder in this location "Avira" ("C:\Program Files (x86)\Avira\")
    i want to trying like this

    If Environ("Path") <> "C:\Program Files (x86)\Avira\" Then Exit Sub
    but its not working

  7. #7
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Rum macro only in my pc

    What I am doing currently is create two moduals.One to protect all the worksheets in the workbook and one to unprotect the same and calling unprotect at the begining of my macro( that I want to run only on my pc) and call protect at the end of the macro then share a copy of the workbook then I unshare my original copy of the workbook

    very painfull and hard to do....I hope we will get a proper method here.

  8. #8
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Rum macro only in my pc

    Try this:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,078

    Re: Rum macro only in my pc

    @ ikboy

    perfectly working dear

    thread solved

+ 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] Macro to add another Macro to a button to add into a larger Macro.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2016, 10:51 AM
  2. [SOLVED] Define variable in macro than calling that macro inside another macro
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2015, 10:58 AM
  3. Using a macro on workbook1 to create a button in wb2 and assigning macro "wb2!macro"
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2014, 11:39 AM
  4. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  5. Perform macro "on open" specific file- store macro in Personal Macro Workbook?
    By thompssc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 12:38 PM
  6. lookup macro, solver macro, realtime macro
    By xelhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2011, 06:14 PM
  7. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM

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