So what I'm trying to do is open some images in Photoshop on the press of a button. I can get PS to launch without an issue but it just sits there waiting and does not open the file I am requesting (regardless of format (.png .jpg. bmp etc)).
I have added the Photoshop Object Library through the Add Reference Manager, but I keep getting the following error...
System.InvalidCastException: 'Unable to cast COM object of type 'Photoshop.ApplicationClass' to interface type 'Photoshop._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).'
All I'm wanting to do is open a series of image files from a listBox but I cannot even open an external image file. Any help would be much appreciated.
This is what I am trying...
Dim PSD_App As Photoshop.Application
Dim PSD_Doc As Photoshop.Document
Private Sub OpenInPS_btn_Click(sender As Object, e As EventArgs) Handles OpenInPS_btn.Click
PSD_App = New ApplicationClass
PSD_Doc = PSD_App.Open("E:\TestImageConverter\TestImage.jpg")
End Sub
Thanks for taking the time to look.
Simplest way to open a file in VB with photoshop:
Dim appRef, sampleDoc
Set appRef = CreateObject( "Photoshop.Application" )
' Switch off any dialog boxes
appRef.displayDialogs = 3
' Bring to front
appRef.BringToFront
sampleDoc = "E:/TestImageConverter/TestImage.jpg"
appRef.Open sampleDoc
User contributions licensed under CC BY-SA 3.0