Ask Experts Questions for FREE Help !
Ask
    colbtech's Avatar
    colbtech Posts: 748, Reputation: 66
    Senior Member
     
    #1

    Aug 7, 2009, 07:07 AM
    vb strings in excel
    I know I'm being thick but, the following "almost" works. For some reason the string is not stored in the cell specified, yet the string length is saved and the msgbox shows the values to exist. What's going on? It's Friday I'm close to tears, the sun is shining and I'm off next week.




    Private Sub CheckDirectory()

    VarYear = Right(Date$, 4) ' Get the year
    DoesTopDirExist = "\\OLDSERVER\Climate\Sales Orders (New)" ' Set base directory
    If Len(Dir(DoesTopDirExist, vbDirectory)) = 0 Then ' Does the directory exist?
    MkDir DoesTopDirExist ' if not create the directory
    End If

    DoesDirExist = DoesTopDirExist & "\Sales Orders " & VarYear ' Create an annual directory
    If Len(Dir(DoesDirExist, vbDirectory)) = 0 Then ' Does the directory exist
    MkDir DoesDirExist ' if not create it
    End If
    Sheet2.Cells(25, 253).Value = Len(DoesDirExist) ' save the length of the string
    Sheet2.Cells(24.253).Value = DoesDirExist ' save the string (should be "\\OLDSERVER\Climate\Sales Orders (New)\Sales Order 2009")

    MsgBox "File sub - " & DoesDirExist & " - " Len(DoesDirExist) 'Msgbox show "File sub - \\OLDSERVER\Climate\Sales Orders (New)\Sales Order 2009 - 55"

    End Sub
    colbtech's Avatar
    colbtech Posts: 748, Reputation: 66
    Senior Member
     
    #2

    Aug 7, 2009, 08:22 AM

    Sorted... AAAARGH! No more tears, pub is calling. Amazing what a full stop instead of a comma does to code!!

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

IUD removal when strings too short [ 3 Answers ]

I went to get my IUD remove today and the lady was not able to find it. I know I still have it since I haven't had a period in over two years. She told me I will need a surgery to remove it, but first an ultrasound to find it. Is there any other way to remove it with out surgery? Should I try...

Compare strings [ 3 Answers ]

How can I compare two strings without using strcmp() function?

No Strings Relationship [ 4 Answers ]

I am sleeping with a guy, we are having I guess what you can call no strings sex. I really like him which I guess is my reason for sleeping with him, deep down I am hoping he will fall for me. Am I wasting my time and does he have any respect for me.

Is no strings attached sex OK [ 4 Answers ]

I just split up with my boyfriend and I have been in touch with a lad from school who I always had a soft spot for but we were good friends. He always used to ask me about sex and stuff at school and he said its because he wanted me. That wa 4 years ago. We have just been talking and he was...

Sex with no strings? Impossible! [ 15 Answers ]

Ok, now I'm really confused! As some of you know I recently told my ex-girlfriend how I wanted to start seeing her again and possibly get back together. She told me she still thought about me all the time and missed me, however she was enjoying her freedom and being single right now. This weekend...


View more questions Search