Print Page | Close Window

VBA Code

Printed From: www.exp-systems.com
Category: PDF reDirect
Forum Name: Programming
Forum Discription: VBA and Batch Tools to control PDF reDirect Pro
URL: http://www.exp-systems.com/Forum_exp/forum_posts.asp?TID=404
Printed Date: 03 Oct 24 at 6:22AM


Topic: VBA Code
Posted By: sbconsult
Subject: VBA Code
Date Posted: 02 Mar 08 at 4:52PM
Just trying out the code. It fails very early when looking for an existing file on this line:    ------- If Dir$(MyOutputPath & "\" & MyOutputFilename) Then Kill (MyOutputPath & "\" & MyOutputFilename) -------
It is however getting the correct path and filename.
Any clue as to what I am doing wrong ?




Replies:
Posted By: Michel_K17
Date Posted: 03 Mar 08 at 12:22AM
Hi,

    No, I am not exactly sure. What is the error message?

    What you can do is break the line into three lines as follows:

    If Dir$(MyOutputPath & "\" & MyOutputFilename) Then
        Kill (MyOutputPath & "\" & MyOutputFilename)
    End If

    Also, I would add a test to the If statement as follows:

    If Len(Dir$(MyOutputPath & "\" & MyOutputFilename)) > 0 Then
        Kill (MyOutputPath & "\" & MyOutputFilename)
    End If

    I hope that helps.




-------------
Michel Korwin-Szymanowski
EXP Systems LLC


Posted By: sbconsult
Date Posted: 03 Mar 08 at 1:01AM
Thanks Michael, I had already split this line of code and added the 'End If' to no avail, but adding the 'If Len > 0' did the trick. I thing it would be safer to issue the code snippet with that condition included. By the way the error I was getting was error 13 (Type mismatch).
Now the code passes this point but I get a new error (Coded error 0) because the product is not registered. I am testing at the moment to see if PDF_Redirect is suitable to include in a piece of software I have written in VBA. I need to be able to do a silent install and simply need the outputs to be saved as PDF (from MS excel) before appearing on screen for printing.(In fact my software offer the option to "Save only, No Printout" or "Save & Print")  It looks as if this software will do it, but was trying to test it further before buying 20 - 30 licenses which I will need.
I need to ensure all the settings available can be set using VBA (Stamp or no Stamp, Merging , emailing etc)


Posted By: Michel_K17
Date Posted: 03 Mar 08 at 8:37AM
Hi,

    OK, I'll take a look at the registration thing. I think you can bypass the warning, and it will still work (but expect a watermark to appear on the output).

    Are you currently using my VBA code, or have you modified it already for your needs.

    Silent install is possible (in fact, that option exists with the installer), but there is a requirement for the user to have administrator priviledges (this is a Windows requirement which cannot be worked around). I just thought you should know. The only other way is to use a PDF library and construct the output from scratch, bypassing the Windows print spooler entirely. The end result can be faster, but may also require hundreds of lines of code.

    You could consider making the availability of PDF reDirect Pro as a "bonus" portion of your software. and make the installation visible. Afterwards, the installation of a Batch PDF printer can be made silently (see my code VBA for an example)

    Cheers!



-------------
Michel Korwin-Szymanowski
EXP Systems LLC


Posted By: sbconsult
Date Posted: 03 Mar 08 at 2:20PM
Thanks for the prompt reply. I am testing with 2 copies of the code. The first one is only modified to add the condition/qualification to "Kill if already exists", otherwise unchanged.
I have modified the second copy to ascertain what degree of personalization and settings I can achieve through code. I cannot remove the small stamp in the page header section or the large stamp/watermark running diagonally across entire page.
The preamble to the source code stipulates " This ActiveX control and sample code is installed as part of PDF reDirect Pro. and will work free of charge for 90 days after installation. Afterwards a watermark (stamp) will be added to your PDF files created or modified by using this ActiveX Control."
I am confused about the large watermark being a license issue, but am also concerned about the persistent small header stamp, despite having remarked line 348 of your sample class module.
The software I am about to distribute is intended for a number of stand-alone machines which all individually, have Administrator's rights. So the silent install is not an issue and the preferred method. Users will be advised separately of the bonus software being available to them post installation.
Please confirm that I can get rid of all stamps (through code with all required setting applied as part of the silent install) when using a registered version.
Also please confirm how will the individual licenses be activated. Will I have to write personalized installation scripts for each license?


Posted By: Michel_K17
Date Posted: 03 Mar 08 at 2:45PM
Hi,

   I am sure that the watermarks will go away once the produt is licensed. I'll take a look to confirm for you, and show you a sample later today.

   For the licensing, typically, the purchaser receives a key which needs to be manually entered. However, if you know how many you need, and it's greater than 20, then I can offer you a registration "datafile" to fully automate the registration process.

   I'll have more info for you soon.


-------------
Michel Korwin-Szymanowski
EXP Systems LLC


Posted By: Michel_K17
Date Posted: 04 Mar 08 at 12:00AM
Hi,

    I'm getting a bit confused. You mentioned "line 348 of your sample class module", yet I have not provided a class module in over a year. The latest sample VBA code makes use of an ActiveX component which gives more features, and has a number of bug fixes.

    So, I am wondering if perhaps you are using an old version of my sample VBA code. The latest programming sample code is v2.2.5.

    If you are using v2.2.5, could you tell me which sample VBA code you are using (ie the Word, Excel, Access or VB6). That would help me quite a bit, or simply post line 348 here on the forum so I can go looking for it.

    With respect to the watermark (stamp), it will not appear if your PDF reDirect Pro trial has not exceeded the 90 day trial, so here is a back door to give you "1 day remaining" which should allow you to get rid of the watermark. Repeat daily for your testing purposes. If anything, it will give you the warm and fuzzy feeling that you can make the watermark go away once the product is registered.

    The back door is:
  1. Start PDF reDirect Pro, and go into the Preferences
  2. Select "PDF reDirect Freeware" as the Startup Mode
  3. Click "OK"
  4. Click the "PDF reDirect Pro" large promo button
  5. Click the "Activate Pro Version" button
  6. Program should now return to "Pro" mode with "1 day remaining"
    Cheers!



-------------
Michel Korwin-Szymanowski
EXP Systems LLC


Posted By: sbconsult
Date Posted: 04 Mar 08 at 2:01AM
Sorry I should not have used the word 'Class' but simply 'Module'. Here is the line where remarking the line appears to have no effect.

'        .Settings_Stamps = "CONFIDENTIAL.pdf, DRAFT - Text.txt""

I am using the "sample code v2.2.5." For Excel

When in debug mode and gliding the cursor over the code: "Trial_Days_Remaining" if correctly confirms "87" so its not as if the trial version had expired.

I am yet to test the fix you indicated and will be happy to see that ithe stamps can be cancelled (unless required) in the registered version.

The part about a registration "datafile" to fully automate the registration process sounds exactly like what I was looking for.

I will be organizing with you an initial batch of 25 licenses over the next few days as soon as I have completed my testing.





Posted By: Michel_K17
Date Posted: 04 Mar 08 at 9:06PM
Ah ha! I think I understand what is going on.

The line:

'        .Settings_Stamps = "CONFIDENTIAL.pdf, DRAFT - Text.txt"

    simply changes the setting in the settings file. If you comment out the kline, then the current setting (which is "CONFIDENTIAL.pdf, DRAFT - Text.txt") will not be changed.

    What you need is to clear the setting, so, you should write:

    .Settings_Stamps = ""

    That explains why you were always getting the watermark. Clearly, this is unrelated to the registration issue which I misunderstood as the problem, particularly since you have a lot of days left.

    Hopefully that will be it!



-------------
Michel Korwin-Szymanowski
EXP Systems LLC



Print Page | Close Window