Ask Experts Questions for FREE Help!
Ask    ||    Answer
 
Advanced  
 

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > Visual Basic   »   vb strings in excel

 
Thread Tools Search this Thread Display Modes
Question
 
 
#1  
Old Aug 7, 2009, 07:07 AM
colbtech's Avatar
colbtech
Senior Member
colbtech is offline
 
Join Date: Aug 2005
Location: Guernsey
Posts: 702
colbtech See this member's comment history on his/her Profile page.
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

Reply With Quote
 
     

Answers
 
 
Old Aug 7, 2009, 08:22 AM   #2  
Senior Member
colbtech is offline
 
colbtech's Avatar
 
Join Date: Aug 2005
Location: Guernsey
Posts: 702
colbtech See this member's comment history on his/her Profile page.
Sorted......AAAARGH! No more tears, pub is calling. Amazing what a full stop instead of a comma does to code!!!!!!
  Reply With Quote
 
     

Your Answer
Email me when someone replies to my answer
Join Login





Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

 
Similar Sponsors


Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Similar Threads
IUD removal when strings too short
(3 replies)
compare strings
(3 replies)
No Strings Relationship
(4 replies)
is no strings attached sex ok
(4 replies)
sex with no strings? Impossible!
(15 replies)

Search this Thread

Advanced Search

Bookmarks

Sponsors



Copyright ©2003 - 2009, Ask Me Help Desk.
All times are GMT -8. The time now is 04:12 AM.