Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

protect excel from QV macro

HI Community

I would like to know how can I done this process in QV .. I upload file for more explane

I have an Extension on a server like that "\\eros\Calibracao\Certificados" and have folders have names of month and year like that "CCA0810", "CCA0910","CCA1010" and inside each folder have excel files

I want to create a Macro for 2 buttons one of them make protection and other remove the protection ..

I done that process on VB6 but also i want it on QV

as you know inside VB6 you make a variable for the direction like that

Option Explicit
Public path As String

and after that you call your button for protect like that

Sub vblExportar()
Dim olExcel As Object
Set olExcel = CreateObject("excel.application")
olExcel.Workbooks.Open FileName:=path , UpdateLinks:=0

olExcel.ActiveWorkbook.Worksheets("Grafico").Activate
olExcel.Application.DisplayAlerts = False
olExcel.ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True, Password:="auditoria"
olExcel.Save

olExcel.ActiveWorkbook.Worksheets("Outros").Activate
olExcel.Application.DisplayAlerts = False
olExcel.ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True, Password:="auditoria"
olExcel.Save
olExcel.SaveWorkspace
olExcel.Workbooks.Close
olExcel.AlertBeforeOverwriting = False
olExcel.DisplayAlerts = False
olExcel.Quit
Exit Sub

So how can i make that on QV when i select the file form the list ... thanks

3 Replies
Not applicable
Author

is anyone can help please

Not applicable
Author

If anyone have idea please can help me?

Not applicable
Author

no oe can help me with his ideas ?