--------------------------------------------
On Mon, 7/24/17, Paul Schreiner <schreiner_p...@att.net> wrote:

 Subject: Re: $$Excel-Macros$$ Macro Error in line. .
 To: "excel-macros@googlegroups.com" <excel-macros@googlegroups.com>
 Date: Monday, July 24, 2017, 5:48 PM
 
 I
 took a quick look, but since I don't have any .CDS
 files, it didn't work properly.
 But
 a couple of observations:#1)
 I'd add Option Explicit to the start of the module, to
 ensure all variables are declared.#2)
 It's curious that your  editors aren't showing a
 compile error on "Dim
 Dirpath as String" since it's being declared
 twice.
 It's
 also possible that since you're using a "On Error
 Resume Next" statement, but not using "On Error
 Goto 0" to reset it, then you're getting an error,
 but not displaying it.I'd
 also change:Dirpath
 = Dir(dpath + "*.CDS")to:Dirpath
 = Dir(dpath & "*.CDS")since
 "+" is an arithmetic function and
 "&" is a concatenation of strings.VBA
 SHOULD handle it properly, but I don't like to make
 assumptions like that.
 I'd
 set a breakpoint at the Dirpath = Dir(...statement
 and step through it and watch what happens to
 Dirpath.I also like to add a
 "Watch" of:Err.Number
 & ": " & Err.Description (with scope of
 "all modules") so that I can see if an error is
 being caught but not halting due to the "On Error
 Resume Next" statement.
 
 Paul-----------------------------------------
 “Do all the
 good you can,
 By all the means you can,
 In all the ways you can,
 In all
 the places you can,
 At all the times you
 can,
 To all the people you can,
 As long as ever you can.” - John Wesley
 -----------------------------------------
 
 
 
    On Monday, July 24,
 2017 10:03 AM, Secret Shot <secrets...@gmail.com>
 wrote:
   
 
  Hi Experts, 
 I have created a macro to automate
 my work. 
 Its working
 fine on my laptop, but if i am using same file for same
 folder in my dasktop, its skip a action. its not giving any
 error but also not doing what it soupose to
 do. 
 Below is the
 line of code which is not getting excuted, means the value
 of path is not getting assined in my define variable, so my
 loop is not working. 
 however its working fine on my
 laptop but not on desktop, wheree all the enviroment is same
 (window, MS office, same references etc. )
 please help..
 dpath = tpath &
 "\" & nws.Name &
 "\"Dirpath = Dir(dpath +
 "*.CDS")Do While Len(Dirpath)
 > 0ActiveCell.Formula =
 DirpathActiveCell.Offset(1,
 0).SelectDirpath = Dir()Loop 
 
 attaching the
 file with full code.
 -- 
 Pankaj Pandey
 Bhopal
 
 
 
 
 -- 
 
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you
 wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official
 Facebook page of this forum @ https://www.facebook.com/discussexcel
 
  
 
 FORUM RULES
 
  
 
 1) Use concise, accurate thread titles. Poor thread titles,
 like Please Help, Urgent, Need Help, Formula Problem, Code
 Problem, and Need Advice will not get quick attention or may
 not be answered.
 
 2) Don't post a question in the thread of another
 member.
 
 3) Don't post questions regarding breaking or bypassing
 any security measure.
 
 4) Acknowledge the responses you receive, good or bad.
 
 5) Jobs posting is not allowed.
 
 6) Sharing copyrighted material and their links is not
 allowed.
 
  
 
 NOTE  : Don't ever post confidential data in a workbook.
 Forum owners and members are not responsible for any
 loss.
 
 --- 
 
 You received this message because you are subscribed to the
 Google Groups "MS EXCEL AND VBA MACROS" group.
 
 To unsubscribe from this group and stop receiving emails
 from it, send an email to excel-macros+unsubscr...@googlegroups.com.
 
 To post to this group, send email to excel-macros@googlegroups.com.
 
 Visit this group at https://groups.google.com/group/excel-macros.
 
 For more options, visit https://groups.google.com/d/optout.
 
 
  
    
 
 -- 
 
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you
 wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official
 Facebook page of this forum @ https://www.facebook.com/discussexcel
 
  
 
 FORUM RULES
 
  
 
 1) Use concise, accurate thread titles. Poor thread titles,
 like Please Help, Urgent, Need Help, Formula Problem, Code
 Problem, and Need Advice will not get quick attention or may
 not be answered.
 
 2) Don't post a question in the thread of another
 member.
 
 3) Don't post questions regarding breaking or bypassing
 any security measure.
 
 4) Acknowledge the responses you receive, good or bad.
 
 5) Jobs posting is not allowed.
 
 6) Sharing copyrighted material and their links is not
 allowed.
 
  
 
 NOTE  : Don't ever post confidential data in a workbook.
 Forum owners and members are not responsible for any
 loss.
 
 --- 
 
 You received this message because you are subscribed to the
 Google Groups "MS EXCEL AND VBA MACROS" group.
 
 To unsubscribe from this group and stop receiving emails
 from it, send an email to excel-macros+unsubscr...@googlegroups.com.
 
 To post to this group, send email to excel-macros@googlegroups.com.
 
 Visit this group at https://groups.google.com/group/excel-macros.
 
 For more options, visit https://groups.google.com/d/optout.
 eforma invatamantului  promovata de Spiru Haret  a dat o noua orientare 
scolilor de stat din Romania. Concomitent  insa  a continuat sa functioneze 
invatamantul particular  precum si cel confesional. in ceea ce ii priveste pe 
romanii din provincii!'- aflate sub stapanire straina  obiectivul principal a 
fost apararea scolilor cu predare in limba nationala. in Transilvania si in 
Bucovina

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to