Jump to content
Macro Express Forums

Questions on variables and filenames


dcman98
 Share

Recommended Posts

Hello,

 

I'm new to Macro Express and have had mixed results so far. I mainly use the software for file manipulation, moving and renaming, and using spreadsheets to bring additional data to the files. Currently, what I am working on is this. I have a file who's name is an account number only (ABC123456). Using a spreadsheet, I want to use variables to change the filename. The spreadsheet's columns are as follows: ABC123456 ABC-123456 Bob Smith

 

I set the macro to use the arrow keys to select the first cell, then copy it to the clipboard, then set variable T1 from the clipboard. Then I give it a right arrow, again copy to clipboard, then set variable T2. I do the same to set variable T3.

 

My understanding is that now T1=ABC123456, T2=ABC-1234356, and T3=Bob Smith.

 

I was having quite a difficult time using these variables, so I gave myself a little doublecheck. I set the macro to go to another cell in Excel and then use the type text command and put in %T1%%T2%%T3%. I expected the variables to be in one cell, but instead each variable was in its own cell, in a vertical column, as if it had hit enter between each entry. Does anyone know if this is happening because of the way I set the variables?

 

Using an If->Then statement, I can see that the next problem in my macro is getting it to find the file C:\test\%T1%.pdf When I use the actual value (ABC123456) instead of the variable, the macro works fine. I don't know if this not working is related to the way the variables expressed themselves in excel. The final piece, which may or may not work, is renaming the file to C:\test\%T2% %T3%.pdf It may be having the same issue as T1.

 

If anyone has some idea on why the variables seem to be pressing enter, and what I can do to use a variable to rename a file, I would greatly appreciate the help.

 

Thank you,

 

David

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.

Guest
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.

Loading...
 Share

×
×
  • Create New...