Shortcut start by VBA

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
Gebalkg
User
Posts: 2
Joined: Mon Jan 09, 2023 10:34 am

Shortcut start by VBA

Post by Gebalkg »

Hello,

I use PDF-XChange PRO 9.4.363.0 version and I've created shortcut in PDF Tools module for merging pdf files in specific folder which works very good. Problem starts when I want to execute it as a final step by VBA code. I've tried Shell, ShellExecute, FollowHyperlink in VBA, but Excel VBA returns 'An unexpected error occurred' (FollowHyperlink) or there is no action (Shell and ShellExecute).
Is there any working function in VBA which will simulate casual double click on shortcut from PDF Tools too put in VBA code?

Thank you in advance,

Krzysztof
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Shortcut start by VBA

Post by Tracker Supp-Stefan »

Hello Gebalkg,

Now that you have created your tool - you should be able to run it through the command line as explained here:
https://help.pdf-xchange.com/pdfxt ... ons_t.html
So no need to simulate a "double click" on a link :)

Kind regards,
Stefan
Gebalkg
User
Posts: 2
Joined: Mon Jan 09, 2023 10:34 am

Re: Shortcut start by VBA

Post by Gebalkg »

Thank you for response.
To cut story short my problem was:
Putting "start SHORTCUT DIRECTORY" worked fine manually in cmd.exe.
But when I was using vba "cmd.exe /C start .LNK DIRECTORY" vba returned "The specified path does not exist".

This worked:

Dim wsh As Object
Set wsh = vba.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1

wsh.Run "cmd.exe /C start PDFXTools.exe /RunTool pdft.tool.splitMergePDF THERE IS DIRECTORY OF MY SHORTCUT FROM PDFXTOOLS", windowStyle, waitOnReturn

Really appreciate your help, list of command was kind of hint to find solution.

Krzysztof.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6837
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Shortcut start by VBA

Post by Paul - Tracker Supp »

:)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply