Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Geacs,
In un modulo standard, incolla il seguente codice:
'=========>>
Option Explicit
'Option Private Module
Public Const GWL_STYLE = -16
Public Const WS_CAPTION = &HC00000
#If VBA7 Then
Public Declare PtrSafe Function GetWindowLong _
Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Public Declare PtrSafe Function SetWindowLong _
Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Declare PtrSafe Function DrawMenuBar _
Lib "user32" ( _
ByVal hWnd As Long) As Long
Public Declare PtrSafe Function FindWindowA _
Lib "user32" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
#Else
Public Declare Function GetWindowLong _
Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong _
Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar _
Lib "user32" ( _
ByVal hWnd As Long) As Long
Public Declare Function FindWindowA _
Lib "user32" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
#End If
'--------->>
Public Sub HideTitleBar(frm As Object)
Dim lngWindow As Long
Dim lFrmHdl As Long
lFrmHdl = FindWindowA(vbNullString, "Userform1")
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub
'<<=========
In un altro modulo standard, incolla qualcosa del genere:
'=========>>
Option Explicit
Const sPassword As String = "Pippo" '<<=== Modifica
'--------->>
Public Sub ConvertiModuliPdf()
Dim SH As Worksheet
Dim SHC As Worksheet
Dim srcRng As Range, destRng As Range
Dim lRow As Long, lRisposta As Long
Dim sNome As String, sPath As String
Dim i As Long, iCtr As Long, iTotal As Long
Dim pctdone As Double
sPath = ThisWorkbook.Path & Application.PathSeparator
With ThisWorkbook
Set SH = .Worksheets("Foglio1")
Set SHC = .Worksheets("Foglio2")
End With
Set destRng = SH.Range("C2")
SH.Protect Password:=sPassword, _
UserInterfaceOnly:=True
On Error GoTo XIT
Application.ScreenUpdating = False
lRisposta = MsgBox(Prompt:= _
"Sei proprio sicuro di creare tutte le Cartoline?." _
& vbNewLine _
& "Se premi Si, saranno create tutte le cartoline.", _
Buttons:=vbYesNo + vbCritical, _
Title:="Avvertimento!")
If lRisposta = vbYes Then
With SHC
lRow = .Range("A" & Rows.Count).End(xlUp).Row
Set srcRng = .Range("A3:A" & lRow)
End With
ufProgress.LabelProgress.Width = 0
ufProgress.Show vbModeless
iTotal = srcRng.Cells.Count
For i = 1 To iTotal
With srcRng.Cells(i)
If .Value <> vbNullString Then
pctdone = i / iTotal
With ufProgress
.LabelCaption.Caption = "svilupando file " & i & " di " & iTotal
.LabelProgress.Width = pctdone * (.frameProgress.Width)
End With
DoEvents
destRng.Value = .Value
sNome = destRng.Value & ".pdf"
SH.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=sPath & sNome, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
If i = iTotal Then Unload ufProgress
End If
End With
Next i
Else
Exit Sub
End If
XIT:
Application.ScreenUpdating = True
End Sub
'<<=========
Potresti scaricare il mio file di prova Geacs20190703.xlsm
===
Regards,
Norman