Consulting

Results 1 to 4 of 4

Thread: Solved: Drive Letter

  1. #1

    Solved: Drive Letter

    I need help to correct this code:-

    [VBA]
    Sub drl()
    If Cells(65536.256).Value Is Nothing Then
    DriveL = InputBox("Please specify your Drive Alphabet where File exists: ", "JustDrivingSoft", "C")
    Cells(65536, 256).Value = DriveL
    Else
    DriveL = Cells(65536, 256).Value
    End If

    End Sub
    [/VBA]

    Is there a permanent way, that even after closing file, my program will remember the Drive Letter input by me? It will not ask again through Inputbox.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Won't it know because it is now stored in the worksheet?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Howdy All,

    In your first Cells(), you need a comma, not a full-stop. Also, you cannot test for Is Nothing against a string. Try:
    [VBA]Sub drl()
    Dim DriveL As String

    If Cells(65536, 256).Value = vbNullString Then
    DriveL = InputBox("Please specify your Drive Alphabet where File exists: ", "JustDrivingSoft", "C")
    Cells(65536, 256).Value = DriveL
    Else
    DriveL = Cells(65536, 256).Value
    End If

    End Sub
    [/VBA]

  4. #4
    Thanks XLD and GTO. It worked. I will be glad to be help to you both.

Posting Permissions

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