Jump to content
Macro Express Forums

Create Folder And Set String Variable Problem


Recommended Posts

I'm using the following where Folder_on_Pc is a range name in excel's Timesheet.xls that contains a file folder and path (e.g. "C:\shoe\CC\ANA\1Current\DE-Tech-20070301-LCA"), but the folder doesn't get created. Why?


<TEXTTYPE:<ESC><ESC>><DELAY:1><ACTIVATE2:timesheet.xls><WAITWIN2:000010:000000:Excel - timesheet><TEXTTYPE:<F5>><WAITWLF2:000010:000000:timesheet><WAITWIN2:000010:000000:Go to><TEXTTYPE:Folder_On_PC<ENTER>><WAITWLF2:000010:000000:Go To><WAITWIN2:000010:000000:Excel - timesheet><CLIPC><TVAR2:01:03:><TEXTTYPE:<ENTER>><DOFILE:02:NN:%T1%>><TEXTTYPE:<ENTER>>


If I do it without using a string variable, it works fine. e.g.



I've also added a textbox to ensure that %T2% has the right value after the clipboard command... it does.


Any ideas?

Link to comment
Share on other sites

Jim -


Any ideas?

One. Add a Delay after the Clipboard Copy command. Something small like 250 or 500 ms. Anything that Windows does with the clipboard takes a lot of computer time.


Another one ... replace the Clipboard Copy command with the native Text Type: <ALT>ec. Use lowercase for the e and c. And leave the Delay command.

Link to comment
Share on other sites

Thanks for your response. I tried the delay and replacing the clipboard copy with ALT ec in Excel (edit-copy). It still doesn't work. Like I wrote in the original post, the copy seems to have been working all along because when I added a text box to display %T2% before the file create command, the text box did show the correct file name and path. Any other ideas, anyone? The Create Folder command doesn't appear to be working with a variable, but does work with a text input. What's doing on?

Link to comment
Share on other sites

It is possible that T1 contains extra characters. In one of my macros Excel (or the Windows clipboard) insisted on adding a CRLF at the end of the data copied to (or from) the clipboard. An extra CRLF at the end of the folder name may cause the Create Folder command to fail. Extra spaces at the beginning or end of the pathname may also cause problems.


One way to check that the pathname is correct would be to add a Text Box Display command to display %T1%. Put something like >%T1%< or '%T1%' in the Box Content field. If you see that the pathname is something like:




then you know you have an extra CRLF.


If you see something like:

>C:\shoe\CC\ANA\1Current\DE-Tech-20070301-LCA  <


'  C:\shoe\CC\ANA\1Current\DE-Tech-20070301-LCA'

then you know you have an extra space.


There are macro commands to delete the extra CRLF and/or extra spaces.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...