+ Reply to Thread
Results 1 to 8 of 8

If the USB is plugged in, then save onto it

  1. #1
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    If the USB is plugged in, then save onto it

    I want my macro to Save the workbook onto my USB E:\ drive, if I have it plugged in;
    what is the syntax for the condition "If E:\ is available"... or "If USB exists"... ?

    Thanks for any help.
    AC
    Last edited by aca; 06-17-2020 at 11:42 AM.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: If the USB is plugged in, then save onto it

    If you are only checking drive exists or not...

    Something like below.
    Please Login or Register  to view this content.
    EDIT: DriveCheck() returns True if drive exists. So you can use that in your If statement. Also note that this only works for Windows based system.
    Last edited by CK76; 06-17-2020 at 12:04 PM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: If the USB is plugged in, then save onto it


    Other ways : just managing the Dir VBA function or searching for the volume name rather than the drive unit …
    Last edited by Marc L; 06-17-2020 at 12:27 PM.

  4. #4
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Re: If the USB is plugged in, then save onto it

    Thank you, CK76; in fact, what I want is to go on and save my file onto the USB, if I have it plugged-in.
    I'm not sure I'll know how to use all that code as just the condition for saving or not (or ending the macro).
    ACA

  5. #5
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Re: If the USB is plugged in, then save onto it

    Thank you, Marc L. The fields you mention, Dir VBA and Volume name, are both new to me; I'll explore them.
    ACA

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: If the USB is plugged in, then save onto it

    Something like...
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Re: If the USB is plugged in, then save onto it

    Oh, oh... thank you very, very much, CK76! This is exactly what I need.
    ACA

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: If the USB is plugged in, then save onto it

    You are welcome and thanks for the rep

+ 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. Inquiery Form data plugged into excel database??
    By Rpatel1974 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-12-2016, 11:27 AM
  2. Replies: 1
    Last Post: 04-29-2016, 11:55 AM
  3. Need Serial number plugged in a column to come out in one cell separated by commas
    By boogyman33 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-27-2013, 08:21 AM
  4. Formula for converting all values plugged in automatically
    By Jose-S in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-10-2013, 12:10 PM
  5. Disable Save As and Save - enable Save via button
    By LampCommandr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-07-2011, 05:42 PM
  6. Highlight "Plugged" Formulas
    By cfreel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-31-2007, 02:05 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