OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 29-09-2009, 16:47
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default gotta be a better way to rename files

Hi,
Just curious.
This method seems a little crude.
It pads filenames with a certain amount of zeros when renaming/saving.

gotta be a better way, ....just curious.

Code:
If i < 10 Then
            addzeros = "00"
        End If
        If (i < 100) And (i > 9) Then
            addzeros = "0"
        End If
        If (i > 99) Then
            addzeros = ""
        End If
        ActiveDocument.SaveAs "D:\All Graphics\__temp\" & addzeros & i & ".cdr", SaveOptions
Reply With Quote
  #2  
Old 29-09-2009, 18:23
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,787
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Format

You could use the Format function to add them.

Code:
i = Format(i, "000")
Should give you the result you want.

-Shelby
Reply With Quote
  #3  
Old 30-09-2009, 17:00
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Well that makes it easy....Thanks Shelby

I'm gonna have to start memorizing a function a day.
Reply With Quote
  #4  
Old 01-10-2009, 08:40
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Rather than memorizing functions, you could install VBA MZ-Tools 3.0 (http://www.mztools.com/index.aspx) and VBE Tools 2.0 (http://www.oaltd.co.uk/VBETools/Default.htm). This allows for saving commonly used functions and "code snippetts" for use in other projects. It has been a life saver for me. They are both free to download and use. They were referred to me by Os.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #5  
Old 02-10-2009, 21:39
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi,
Works great. I just had to create a new var since the i from the loop was a int.

It wouldn't pad it unless its a string.

Code:
newi = Format(i, "00000")
        
        
        ActiveDocument.SaveAs "D:\All Graphics\__temp\" & newi & ".cdr", SaveOptions
Thanks for the tip on the addon.
I installed it and have yet to play.
Reply With Quote
  #6  
Old 14-05-2010, 14:03
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Quote:
Originally Posted by ddonnahoe View Post
Rather than memorizing functions, you could install VBA MZ-Tools 3.0 (http://www.mztools.com/index.aspx) and VBE Tools 2.0 (http://www.oaltd.co.uk/VBETools/Default.htm). This allows for saving commonly used functions and "code snippetts" for use in other projects. It has been a life saver for me. They are both free to download and use. They were referred to me by Os.
Just wanna say thanks Sean. Great recommendation!
-John
Reply With Quote
Reply

Tags
file rename, pad with zeros


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
rename pages robert Macros/Add-ons 2 23-01-2008 01:16
saving draw i2 files as draw 11 files KDJ General 5 01-03-2006 17:26


All times are GMT -5. The time now is 06:10.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com