Author Topic: RENAMING FILES  (Read 2800 times)

0 Members and 1 Guest are viewing this topic.

krampaul82

  • Newt
  • Posts: 179
RENAMING FILES
« on: June 30, 2010, 05:03:50 PM »
<see attached modules>

This program will take and create a new project directory structure with a user assigned project name, number etc.
once a new project has been created it somtimes needs to have a project number re-assigned is there a way to rename these files the same way they were created?  I hope I am making sense here...
 

is there a way to have the program continue after this msgbox without hitting OK? (like a little 2 second delay and the program will continue)
MsgBox "Excel Files W/Prefix are in place. On to the Data Extraction Files..."


When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: RENAMING FILES
« Reply #1 on: July 01, 2010, 08:13:33 AM »
Try this...

Code: [Select]
Sub TimedMsgBox()
    Dim cTime As Long
    Dim WSH As Object

    Set WSH = CreateObject("WScript.Shell")
    cTime = 2 ' 2 secs
    Select Case WSH.Popup("Open an Excel file?!", cTime, "Question", vbYesNo)
        Case vbOK
            MsgBox "You clicked OK"
        Case vbCancel
            MsgBox "You clicked Cancel"
        Case -1
            MsgBox "Timed out"
        Case Else
    End Select
End Sub
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Newt
  • Posts: 179
Re: RENAMING FILES
« Reply #2 on: July 01, 2010, 10:15:56 AM »
Matt,

Well, now I learned a new way to display a message box, thank you for that code but I want to display a message for a brief time and then continue on to the next line of code without the user having to hit "OK" Is this possible? :|

Mark
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: RENAMING FILES
« Reply #3 on: July 01, 2010, 10:17:43 AM »
That's what that code does; it displays a msgbox for 2 seconds then continues.  The lines that read:

Code: [Select]
        Case -1
            MsgBox "Timed out"

is where you would put your code to continue.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Newt
  • Posts: 179
Re: RENAMING FILES
« Reply #4 on: July 01, 2010, 11:33:42 AM »
Matt

The message box just sits there infinitely, it does not continue...



Select Case WSH.Popup("Open an Excel file?!", cTime, "Question", vbYesNo) should this be vbok?       
 Case vbOK
            MsgBox "You clicked OK"
        Case vbCancel
            MsgBox "You clicked Cancel"
        Case -1
            MsgBox "Timed out"
        Case Else
    End Select


Mark
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: RENAMING FILES
« Reply #5 on: July 01, 2010, 11:46:53 AM »
It looks like you didn't copy the entire chunk of code.  What you just posted is missing

Code: [Select]
    Dim cTime As Long
    Dim WSH As Object

    Set WSH = CreateObject("WScript.Shell")
    cTime = 2 ' 2 secs
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Newt
  • Posts: 179
Re: RENAMING FILES
« Reply #6 on: July 01, 2010, 12:44:05 PM »

I put your entire code in a module and call the sub from where I placed the msgbox code still no dice.... :oops:
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: RENAMING FILES
« Reply #7 on: July 01, 2010, 01:26:41 PM »
Can you post all or part of the code?  Are you doing it in Excel or AutoCAD?
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Newt
  • Posts: 179
Re: RENAMING FILES
« Reply #8 on: July 01, 2010, 03:09:36 PM »
Matt
Look at posted module #1 (kind of long) but the sub "gtc_move_Excell" call's from module3 (posted) where i now display the msgbox is where I now would call your sub "TimedMsgBox" instead. this works and by that i mean it displays a msgbox but it does not timeout.  I guess i could skip the msgbox alltogether and quietly finish the program but i like to let the user know where the program is at....
Mark
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: RENAMING FILES
« Reply #9 on: July 02, 2010, 01:42:28 PM »
Take a look at this sample I threw together.  Run the MAIN sub.  It will prompt you to open an Excel file.  Don't do anything.  After 2 seconds, it will automatically continue by loading a userform (frmMain) and which will display a progress bar.

Instead of loading the form, you would put in your code to do whatever it is you want.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

krampaul82

  • Newt
  • Posts: 179
Re: RENAMING FILES
« Reply #10 on: July 06, 2010, 12:10:13 PM »
You only supplied the progerss bar.... ;-)
When i see someone fall, my first instinct is to laugh!
but then i think, wait a minute! they could of fallen on ME!
Mark