Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

manage document properties with macro

Hello,

I wrote a macro that puts an image on the background and prints the sheet.

But I have to prohibit the print by file menu (Print File, Print PDF ecc) so the only way to print for the users will be the button with the macro.

I know that in the “setting” menu, you can manage by “document properties”, by flag “allows printing (when export is prohibited)”, but if I disable flag the macro doesn’t works….

The question is: is possible to manage this flag inside the macro, so I can put this flag, run the other script of the macro, and then disable the flag?

If is not possible there is other way to do that??

Thanks in advance for your answer

Ivan

MACRO CODE:

sub WP

set temp = ActiveDocument.GetApplication.GetProperties


status = ActiveDocument.SetWallPaper("\\link\pippo.jpg", 1)

set docprop = ActiveDocument.GetProperties

docprop.UseBkgImage = true

ActiveDocument.SetProperties docprop

rem ** set document for fit to page landscape sheet printing **

set docstampa = ActiveDocument.GetProperties
set ps = docstampa.PrintSheetSettings
ps.Landscape = true
ps.PagesX = 1
ps.PagesY = 1
ps.PrintCurrentSelectionPosition = 4   'bottom
ps.UseScale = false                    'fit to page
ActiveDocument.SetProperties docstampa


set s=ActiveDocument.ActiveSheet

s.Print true


docprop.UseBkgImage = false

ActiveDocument.SetProperties docprop


end sub

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    

   Here is the code i found from API guide.

temp=ActiveDocument.GetProperties

temp.UserPermissions.AllowPrintAnyway = false

ActiveDocument.SetProperties temp

   At my side its not working properly. You can try your side.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The AllowPrintAnyway property in the API is read-only.

-Rob

jafari_ervin
Creator III
Creator III

if AllowPrintAnyway is read only why this macro exist in API Guide?

(

temp=ActiveDocument.GetProperties

temp.UserPermissions.AllowPrintAnyway = false

ActiveDocument.SetProperties temp

)