Folder Structure By Shell

Nov 18, 2009

I want to find the folder structure, but walking down. I have try this code

View 2 Replies


ADVERTISEMENT

Use The Shell Method To Open Files And Folder

May 11, 2007

I know this is simple, but im having problems finding it in search. Im using the Shell method to open files, but how to open folders?

View 7 Replies View Related

Create A Folder Structure Before Dumping A CSV Export

Jan 19, 2010

I am trying to create a folder structure before dumping a CSV export frm the Excel. I am trying to use MkDir but it gives me a run time error 76.

I am testig the code in my PC. Pleaselet em know if I have to change any configuration in excel file.
Also, is there a way to call the windows system command and create the folder structure?

View 9 Replies View Related

Import Folder Structure Into Worksheet & Hyperlink

Sep 7, 2006

I have found the code shown below that imports Folder Contents into a Worksheet in Excel, however i need to import a folder tree structure for a set of folders into a worksheet not the folder contents. Is it possible to do this?

Could the code i found below be altered to list the folders not the folder contents?

The code is:

Sub Print_Dir_Contents()
Dim Input_Dir, Print_File As String
Input_Dir = InputBox("Input the path containing the files you " & _
"want to list on your worksheet" & Chr(13) & Chr(13) & _
"for example:C:My Documents*.*")
If Input_Dir = "" Then Exit Sub
' If you want only to print a specific file type, you can
' substitute the "*.*" with "*.xl*"
' (for Excel files only) for the directory specified in the
' InputBox above.
If Application.OperatingSystem Like "*Win*" Then
Print_File = Dir(Input_Dir) & "*.*"
End If

View 9 Replies View Related

Shell Command In Vba

Jun 29, 2007

I have to run command prompt from with my VBA code , and run an application passing it 2 filenames and redirecting the output of the application to a third file. Also my VBA script should wait for the application to complete running before getting back to the next line of execution. HEre is what i have coded so far :

Sub Macro1()
Dim dosCmd As String
dosCmd = "purge.exe input1.txt input2.txt >> opFile.txt"
Call Shell("cmd.exe " & dosCmd, vbNormalFocus)

Now this code ends up just opening the command prompt and nothing else. It does not run purge.exe.

View 2 Replies View Related

Way To Enter A Second Shell Command After The First One

Aug 11, 2008

I have written a Shell command. It is very simple and designed to open another software. Here it is:

Dim X As StringX = Shell("C:Program FilesMicrosoft OfficeOFFICE11xlview.exe", vbNormal)

Is there a command that will close the open program? Something along the lines of
.....Ofice11xlview.CloseProgram", ...

But more importantly, is there a way to enter a second shell command after the first one that will have XLViewer to open a particular workbook after the viewer is open?

View 9 Replies View Related

Shell To Open Word

Jun 2, 2009

not sure why this is not working, it is from Access I know this is the wrong forum but figured I haven't got any answers from anywhere else and it seems like a simple fix

this command fails... i am guessing its to do with the file path having spaces but don't know how to get it to work, what to insert so it will work.

Call Shell("V:Program Files (x86)Microsoft OfficeOFFICE11WINWORD.EXE / L:Best Practice ManualFull Labour Hire Best Practice Manual.doc", 1)

View 9 Replies View Related

VBA Shell Command On A .BAT (batch) File

Jul 13, 2009

I was trying to run the shell command in VBA (excel2007) on a .BAT(batch) file. While running the macro, the DOS command prompt appears and goes away in a flash but the function of the .bat is not performed which makes me think that the shell command isnt functioning properly. I had this proper earlier also with a few Exe's.

the line of the macro that calls is (c is the path for the batch file) :

Call Shell(c, vbNormalFocus)

Could any of you help me with some suggestions regarding this problem.

Just to confirm, the batch file on itself works absolutely fine and it looks like it doesnt take more than 2 seconds to run it. It also does not wait for any input from the macro. it is an individual batch just included in the macro.

View 15 Replies View Related

Shell Command Not Working With Windows 7

Nov 17, 2009

I'm very much in a bit of a pickle. I have updated my operating system from vista to windows 7 and a macro no longer works. The old code is

View 4 Replies View Related

Using Variable String In Shell Command

Nov 1, 2013

I'm trying to use a variable that hold a string in Shell string command. This shell is the command to take a snap picture over a given region and store the picture to a pre determined file name

***The code do compile***

The string variable is : StringAddress = "g: estsnapasnap1.jpg"

The following shell command will work

RetVal = Shell(("C:Program Files (x86)HyperSnap 7HprSnap7.exe " & " -hidden
-snap:x3602:y155:w1432:h830 -save:jpg g: estsnapasnap1.jpg"))

This one, with the string address variable, wont work

RetVal = Shell("C:Program Files (x86)HyperSnap 7HprSnap7.exe " & " -hidden
-snap:x3602:y155:w1432:h830 -save:jpg " & StringAddress)

View 1 Replies View Related

VB Shell Command To Browse Files

Oct 15, 2008

I'm in the process of building a user form that required the user to brows for a file, the path of the file that they select is then displayed in the textbox next to the "browse" button in my form. I also have another button next to this which when selected will open the file that is displayed in the textbox previously mentioned.

I’ve been trying the shell command but with no success, I can get the user form to open adobe reader but whenever I try to include that file path for which to open the file I keep getting runtime errors,

Below are a couple of examples that I’ve tried (you'll prob be able to guess from the code that I’m very new to VB in excel).

For additional info the value in the textbox would be something like, "H:My DocumentsPDF Filesmyfile.pdf"

Dim GetFile As String
Shell "C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe", vbNormalFocus
'this opens adobe reader but I'm trying to open a specific file

Shell "C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe" & textbox9.value, vbNormalFocus
This produces the runtime error again

Dim GetFile As String
GetFile = TextBox9.Value
Shell "C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe" & GetFile, vbNormalFocus
'this produced a runtime error - to be honest this was an attempt born out of frustration.

View 9 Replies View Related

Shell Function To Make This Run From A VB Macro

Jul 3, 2006

I'm trying to run an application using a VB macro. The command line provided to me is "C:Program FilesWeb Scraper Plus+PkgExec.exe" -p "5A147DC7-0420-4321-9DEC-02B8D8111A78". This command line works fine from my Run menu. Now how do I write a Shell function to make this run from a VB macro?

View 4 Replies View Related

Excel 2010 :: Error In Shell During Opening PDF

Feb 25, 2014

I'm using excel 2010 and pdf creator to make a pdf (and open it automatically). It works with the following code:

[Code] .....

path and filename are previously defined objects.

I'm using pdfcreator because the code also has to be used with excel2003 on another pc. The problem is that I get an error (probably for trying to open the newly creating pdf-file).

Error 2417024894 (80070002) during execution. Method run of Object IWshSell 3 failed.

View 2 Replies View Related

Using Macro To Enter Variables To Shell Command

Oct 12, 2009

I want to run a Shell command to open lots of files.

I can get the basic command working, but I want to open a lot of different files and am seeing if there is a way to save time by having a variable input, rather than having 1000 different shell lines with IF statements.

View 8 Replies View Related

Pausing Within For Loops Until Shell Command Is Complete

Nov 3, 2009

I have written a For loop that uses a shell command to call a batch file that replaces text in some text file, Mytrail.txt. I then use that altered text file and use it to run a 3D modeling program Pro/Engineer by calling it through another shell command. I would like to add pause instructions to my routine after the shell commands. Below is a snippet of the code I am working with:

For i = 1 To N Step 1
Shell ("Reblacer.bat Mytrail.txt string_A string_B)

'Here I would like to add code that will pause the routine until the batch file 'operation is complete.

Shell "C:Program FilesproeWildfire 3.0inproe.exe Mytrail.txt", vbNormalFocus

'Here I would like to add another pause instruction until the above shell 'command is complete. Note that this shell command creates a new file in 'some directory whose name is actually string_A.prt. Could this be used to 'tell visual basic that it may recontinue executing the routine.

Next i
End Sub

How to add pauses to the routine above that prompt visual basic to continue executing the code only after the shell commands have completed their tasks?

View 2 Replies View Related

Using Shell To Call Batch File Or CMD Prompt

Dec 9, 2011

I'm working on my first VBA project that requires 12 fields to be manually input of which one field is a file path. I need this path for multiple reasons, but the one reason I'm having a problem with is using the location of the path in conjunction with calling a bat file or executing a cmd prompt that is at that path.

Path Location, minus file name:

Code:
sheets("b. Fill Out Required Info").Select
Range("B18").Select
Actual Path found in B18:
C:UsersNickDesktopSubmission ToolTest Files

File attempting to execute:

CopyFileNames.bat

I can manually put all of this together and get what I want by using:

Code:
Shell "C:UsersNickDesktopSubmission ToolTest FilesCopyFileNames.bat", 1

The problem is, every time this will be used, a different path will be used, but the same batch file name will be used. So, rather than having to manually input the file path every time, is there a way to replace "C:UsersNickDesktopSubmission ToolTest Files" with the cell reference of the path listed above? I've tried different methods of this but I cannot seem to get it.

It would be even better if I could just use the cmd prompt found within the batch and run it directly from vba; the prompt I'm running is as follows:

Code:
cd C:UsersNickDesktopSubmission ToolTest Files dir /b/o |find ".xml">ListOfFileNames.txt

How can I put that cmd into VBA? I tried different versions of this with no success:

Code:
Shell "cmd.exe /c cd C:UsersNickDesktopSubmission ToolTest Files dir /b/o |find ".xml">ListOfFileNames.txt"

Notice that the path is the same as the path shown in B18 above. It would be great if that path would be dependent on the cell referenced above.

View 9 Replies View Related

Possible To Reuse Opened Shell Command From Excel VBA

Jul 27, 2014

I am using a shell command to communicate with a device under test and would like to open this shell once, change directory to a specific one and then send different text strings to it at various times during my test program. The code below works perfectly fine but opens and closed the shell each time it is used. I think it woud be quicker if I could reuse it until done and then exit out of it.

Here are 2 examples of a couple different strings I would like to pass into the cmdShell function at various times. I would like to send the first string, perform some measurements and then repeat with the 2nd string.

i.e. shellStr1 = ("cd .. & cd c:ezspi & testdm900 --widn 0x1020 --widv 0x1") then once the shell is open and the directory has been set send shellStr = ("testdm900 --widn 0x1020 --widv 0x5")

Is this possible using WShell Script or do I need another method?

Public Sub cmdShell(shellStr As String)
Dim Test As Double
Dim response As VbMsgBoxResult
Dim cmdObject As Object
Dim ReferenceTime As Double, ElapsedTime As Double

Set objShell = CreateObject("WScript.Shell")

[Code] .........

View 4 Replies View Related

Dictionary Object Structure

Oct 31, 2009

I know the Dictionary Object is confined to the Microsoft Word Object structure though can it be used in Excel. If not, is there a suitable replacement.

View 3 Replies View Related

Tiered Bonus Structure

Jun 18, 2009

I need to present dollar values to my boss for a proposed tiered bonus structure and am trying to figure out how to create the necessary formula.

The bonus structure is as follows:

Level 1$8,500 = 3% of fees up to $8,500
Level 2$10,500 = 5% of fees between $8,501 and $10,500
Level 3$15,000 = 7% of fees between $10,500 and $15,000

Tricky part is bonus amounts do not go back to dollar zero. The percentages are only for the stated range.

EX: Level 1 = $255, Level 2 = 99.95, Level 3 = 314.93
Therefore collecting $15,000 would net $669.88

View 3 Replies View Related

Shell Function Compile Error - Expected Procedure Not Variable

Aug 8, 2014

I have a VBA shell script that worked just fine on another computer, but now it won't run.

The code that won't execute is:

[Code] ........

View 12 Replies View Related

VBA Shell Command To A Launch Applications On All Computers (no File Paths)

Apr 14, 2006

The VBA shell command is as follows:

programPath = "C:Program FilesInternet Exploreriexplore.exe" ' works
'programPath = "iexplore.exe" ' does not work
Shell programPath + " " + fileToLaunch, vbNormalFocus

but the drawback is that the invoked program (iexplore.exe, at least in my case) needs to have the FULL PATH to where the program exists = the "C:Program FilesInternet Explorer" which may or may not work on someone elses computer. This hardcoding will not work and is not transportable.

Is there a trick to find where the executing program lives? or launching it without the path?

View 9 Replies View Related

Set A Password Under The Permissions Tab But All It Does Is Protect The Structure?

Dec 3, 2012

I have set a password under the permissions tab but all it does is protect the structure and not the content. I want all users to be able to view the file, but have to have the password to edit any of the sheets or data on the sheets. I can still protect the individual sheets, but that doesnt quite do what I want.

View 1 Replies View Related

Group / Ungroup - Tree Structure

Mar 6, 2014

I am trying to create a sheet to resemble tree structure of rows. That is by default all the parent rows must be visible and click of + sign, the row should expand to show its child rows which in turn can have child rows but appear collapsed. When I choose two rows and click on Group and select rows, I see a grouping but when I try to collapse using - sign, both 2 rows gets disabled. I want to make the first row as parent and second row as child. How do I do it?

View 1 Replies View Related

Multiple Variables In A Commission Structure

Jan 20, 2006

I'm trying to create a worksheet to calculate ourcommsiion structure, but can't figure out a way to attack it. We have manyvariables (5) in our commission structure based on each order.

Here's how I set it up so far:

(In Cloumns)
A= Order Amount
B= "Y" is A-15%; "N"=A
C= "Y" is B*20%; "N" is B*10%
D= "Y" is B+2%; "N" is B
E= "Y" is B+2%; "N" is B
F="Y" is B+1%; "N" is B
G= SUM(A:F)

For example, if the order is $1000, and I answer y,y,y,y,y=$212.5

How do I create the formulas so I can just put in the order amount and the
appropriate letter to get the correct commission structure?

View 9 Replies View Related

Rewrite Commission Spreadsheet With A New Structure

Jan 20, 2010

I'm trying to rewrite our commission spreadsheet with a new structure and as my excel knowledge is limited, I'm not really getting anywhere.

I'm looking for a few lines of formula however I'll just post one at a time otherwise I'm in danger of scaring you all off!

Firstly, I am trying to work out the formula for the following:

If the value in C7 is up to £14,999 = 1.5% of the whole value is given, if it's over £15,000 = 3.5% of whole value is given. I would like the total amount of commission to show in F7.

View 9 Replies View Related

Formula Structure For IF / THEN With Logical Test Value Ranges

Feb 19, 2014

I'm trying to create a formula that will determine the bonus (%) for sales made. Here's the table:

<10000 sales = 0% bonus
>=10000 sales but <=29999 sales = 5% bonus
>=30000 sales but <=to 44999 = 7% bonus
>50000 sales = 10% bonus

Since the sales and bonus figures are subject to change each year I'd like the formula to point to the numbers but that part seems easy if I can get the formula right.

View 3 Replies View Related

Importing Text File With Complex Structure?

Dec 15, 2011

I run reports that tell me when an individual is supposed to be in the office and when they actually log in, but this is a manual process where I have to go through several hundred people each morning and check. I have created a macro that pulls in their time in and out and makes there name appear as Last, First.

I run a seperate report that creates a schedule with headers and other information that is useless in this process. I have attached a dummy file and get this down to the last, first name and then the times in and such with no headers? I am also trying to keep the total number of people at the bottom in it's own cell.

I am at a loss as the file uses multiple spaces and not ,'s or ;'s etc.

FILE:

From: 12/14/11 Data TotalView 12/14/11
To: 12/14/11 Company ABC 13:45
Daily Start/Stop Unit Name RED

[Code].....

View 2 Replies View Related

Create Folderstructure Based On Structure In Sheet 1

Nov 16, 2007

I would like to automatically create a filestructure in c:projects based on entries in sheet1.

Column A
Row 1: Admin

Column B
Row 1: Meetings
Row 2: Div
Row 3: Presentations

Column C
Row 3: Master presentations
Row 4: External presentations

I have a fixed structure used for all projects, but it differs what each project is using of the structure.

Question:
1. Is it possible to loop through this sheet and create the structure in a predefined location

2. Optional I would like to use a column after/before each folder in sheet 1 where I can use ' ' for not making the folder and 'x' to create the folder.

View 2 Replies View Related

How To Create (Tree) BOM Structure (Excel Sheet Attached)

Jun 19, 2014

I was sent this file and I want to replicate the bill of material tree structure on the left. I'm not sure how it is done.

Image: BOM_example.png

View 1 Replies View Related

Create Work Breakdown Structure (WBS) In Excel Automatically

May 25, 2014

How to Create a Work Breakdown Structure (WBS) in Excel automatically with given data through macros.

In the attached excel sheet

work_breakdown_structure_.xls

Is there any way to do it for data automatically?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved