GrandMasterTuck
In need of medication
- Local time
- Yesterday, 19:28
- Joined
- May 4, 2013
- Messages
- 129
Hi folks. I have a vba function that takes a file named 1.jpg that is stored in the C:\APic directory and resizes it to exactly 240x300 pixels. The file name never changes, the batch file simply calls the ImageMagick script to perform the resize.
The problem? It runs perfect when I double click the batch file using Windows Explorer. But when I click my button on my Access form, which calls the function, nothing happens. And I have no idea why.
Here is the batch file code, verbatim:
And here is my VBA function, verbatim:
I also tried this for the VBA function:
...and I tried this:
Again, if I navigate to C:\$Data\MyAppDir\SysFiles, the batch file 'resize.bat' is in there. If I double-click it, it runs and resizes the file exactly as I want it to. But when I try to run this batch file from within Access using VBA, it blinks as if it's doing something, but the image remains unchanged. I don't understand why... Any ideas?
The problem? It runs perfect when I double click the batch file using Windows Explorer. But when I click my button on my Access form, which calls the function, nothing happens. And I have no idea why.
Here is the batch file code, verbatim:
Code:
@ECHO OFF
convert C:\APic\1.jpg -resize 240x300 C:\APic\1.jpg
EXIT
And here is my VBA function, verbatim:
Code:
RetVal = Shell("C:\$Data\MyAppDir\SysFiles\resize.bat", 1)
I also tried this for the VBA function:
Code:
Call Shell(Environ$("COMSPEC") & " /c C:\$Data\MyAppDir\SysFiles\resize.bat", vbNormalFocus)
...and I tried this:
Code:
Application.FollowHyperlink "C:\$Data\MyAppDir\SysFiles\resize.bat"
Again, if I navigate to C:\$Data\MyAppDir\SysFiles, the batch file 'resize.bat' is in there. If I double-click it, it runs and resizes the file exactly as I want it to. But when I try to run this batch file from within Access using VBA, it blinks as if it's doing something, but the image remains unchanged. I don't understand why... Any ideas?