Hi folks,
I'm having a problem trying to automate a task in Excel because my VB formula requires a manual press of the Enter button or a click on "OK" in the Save As dialog box.
The relevant part of the code is as follows:
The macro basically saves an image on the clipboard as the filename specified in the adjacent cell. This is looped so that the routine should proceed row by row:
However, each time the function executes, the Save As dialog box appears and the macro will not proceed to the next row until I click "OK" in the Save As dialog box. I want to just save the file as the filename specified in the adjacent cell but I can't get around the manual click on "OK" to save the file. I have tried using SendKeys and simulating a left mouse click with focus applied to the "OK" button, but the problem is that the VBA function just seems to stop and wait for user input before proceeding.
Is there any way I can have the filename functionality of the SaveAs command without the manual entry in the SaveAs dialog box?
Thanks!!
I'm having a problem trying to automate a task in Excel because my VB formula requires a manual press of the Enter button or a click on "OK" in the Save As dialog box.
The relevant part of the code is as follows:
Code:
Application.GetSaveAsFilename( _
initialfilename:=ActiveCell.Offset(0, 1), filefilter:=sFilter)
The macro basically saves an image on the clipboard as the filename specified in the adjacent cell. This is looped so that the routine should proceed row by row:
Code:
Loop Until IsEmpty(ActiveCell.Offset(0, 1))
However, each time the function executes, the Save As dialog box appears and the macro will not proceed to the next row until I click "OK" in the Save As dialog box. I want to just save the file as the filename specified in the adjacent cell but I can't get around the manual click on "OK" to save the file. I have tried using SendKeys and simulating a left mouse click with focus applied to the "OK" button, but the problem is that the VBA function just seems to stop and wait for user input before proceeding.
Is there any way I can have the filename functionality of the SaveAs command without the manual entry in the SaveAs dialog box?
Thanks!!