Topics Search

VBA and command line

VBA and command line
Views: 48
I am trying to run a powershell file from command line. What I need to do in command line is

cd D:\Scripts\WTV-MetaRenamer\
powershell -command "& 'D:\Scripts\WTV-MetaRenamer\wtv-metarenamer.ps1' "

I can figure out how to get this done in vba. I have search everything and tried shell and stuff, but I cant figure out how to run one line then the next
Sponsored Links:

More topics


Pass command line parameters

How can I pass a command line parameter to a function in a VBA module. I want to pass the name of a database to an import database function written in VBA

reg.exe through command prompt and Shell in VBA cause different behavior

I'm running Access 2010 32bit on Win7 x64 and was mostly aware of what it means in relation to registry and how it behaves with redirection, but was not aware it will cause discrepancy inhow included Windows libraries perform.

Here's description. Windows (from XP onward I think) include one brilliant little command line app reg.exe which enables tons of tricky operations with Registry in very simple manner. For example, I need to copy a key with subkeys and values to new location (from HKLM to HKCU).

This little app does it in a single line command! and can of course be used from VBA through Shell command.

However, same line run from command prompt and through Shell function copies different keys. The one through command prompt copies asked key, the one through Shell function copies redirected key (from Wow6432Node, instead from HKLM\Software).

Of course, I don't want that! I know everything will be fine on x32 Windows, but on x64 Windows it simply reads wrongkey.

And that's exactly what I tried to avoid by this approach! Is there a way to run reg.exe from VBA as if it's run from command prompt, or force it not to redirect?

IF statement

A very basic VBA question about IF . Else . End if

What I need to do is do the following

If "a certain condition is fullfilled" then
do this
and this
and this

do that
and that
and that

End if

However when I write this in VBA editor in MS access, I get an error, it seems that the code dose not understand that "do this, and this, and this" should be executed if the condition is fullfilled, the code understands each line as a seperate command and it only executes the first line "do this" if the condition is met and not the other 2 lines "and this, and this" and I get other errors regarding Else and End if "that there is no if command"
how do you solve this so that VBA understands that the lines are "together

retrieving data from command line program

I'm a long time reader but first time poster.

I have a command line program that I need to call (with parameters) in access. The program prints a line out to the command line and then quits - I need to somehow get the data it prints into access.

Anybody got any ideas/experience in this

multi lined shell command?

I have some VBA in a MS Access module that properly and successfully executes a shell command that executes a batch file in the following manner:Shell("C:\runthisfile.bat")I am trying to actually place the contents of the batch file into the module. The problem is that the batch file is many lines. How would I write that?

Shell("ftp.exe -s:%0)
Shell("open myftpserver")
probably 100 lines with each line being a separate shell command, but that doesn't work and neither does
Shell(" all lines")Is it possible to essentially shell many lines at the same time thereby making it possible to take say 100 lines resident in a batch file and just placing them all in the VBA module with shell command(s) instead of calling out the batch file that resides outside of the ms access file? It seems that I can only do single line shell commands?

Command button-Build Query/Report

with VBA, Access 2003. Basically I have a Database that track temporary employees: Names, Agency, line employee occupies, rate of pay and hours worked/week.

I want to create a command button that when I click on it, a Query or Report will be created after selecting "Agency" and "Week", and writing a name for the Query/Report, showing the following:

Temps who work for the agency
Line occupied
Hours worked that week.

I know almost nothing of VBA, if someone would be able to give me some "general" code from which I can start figure out

Command-line arguments for Access

I'd like to know if there is a Microsoft Access command-line argument that would allow me to compact the database upon opening.

Format Graph Using Vba

Is there a method to format a graph using vba?

I need to create a line graph and, using VBA, would like to:
* set line colour
* set line thickness

Bearing in mind that the graph will have numerous lines

Access Your Database From the Command Line

Building a Web site for personal use or for a small company is easy if you are familiar with the operating systems, servers and software programs that you need to put the Web site to work. Command lines and queries are quite simple to manage. Read on to learn how to access your database from the command line.

How to export MDB file in the command line in Windows?

I can export Tables from Microsoft Access MDB files using the export option, but my users have many tables to export, and it's cumbersome for them to do so.

Is it possible through Windows in the command line, to output an MDB file to a text file? If it's possible, then, I can put that command in a batch program and allow the users to easily do the export for many MDB files.

For example, at the command line:

MDBTOOLS <filename.mdb> <outputfile.txt&gt