Switch OptionSet in VBa
Posted: Wed Apr 15, 2015 9:20 pm
A double question
a: does it make sense to programmatically switch OptionSet ini ?
Example: before printing from vba (Excel)
set a specific OptionSet file
After finishing the job,
set the 'original' OptionSet file
would the code below be the best solution??
[code]
Part from an existing sub routine..
oPdfSettings.LoadSettingsFile (sLocation & "Theeketel Option Set.ini")
If oPdfSettings.getvalue("optionsetname") <> "" Then 'this is a name I wrote in the ini file myself, but it is not stable
fp = oPdfSettings.getvalue("optionsetname")
Else
fp = oPdfSettings.getvalue("author")
End If
'test it
Debug.Print fp
'loadBasic Option Set.ini
oPdfSettings.LoadSettingsFile (sLocation & "Basic Option Set.ini")
If oPdfSettings.getvalue("optionsetname") <> "" Then
fp = oPdfSettings.getvalue("optionsetname")
Else
fp = oPdfSettings.getvalue("author")
End If
'test it
Debug.Print fp
End Sub
[/code]
Any suggestions?
a: does it make sense to programmatically switch OptionSet ini ?
Example: before printing from vba (Excel)
set a specific OptionSet file
After finishing the job,
set the 'original' OptionSet file
would the code below be the best solution??
[code]
Part from an existing sub routine..
oPdfSettings.LoadSettingsFile (sLocation & "Theeketel Option Set.ini")
If oPdfSettings.getvalue("optionsetname") <> "" Then 'this is a name I wrote in the ini file myself, but it is not stable
fp = oPdfSettings.getvalue("optionsetname")
Else
fp = oPdfSettings.getvalue("author")
End If
'test it
Debug.Print fp
'loadBasic Option Set.ini
oPdfSettings.LoadSettingsFile (sLocation & "Basic Option Set.ini")
If oPdfSettings.getvalue("optionsetname") <> "" Then
fp = oPdfSettings.getvalue("optionsetname")
Else
fp = oPdfSettings.getvalue("author")
End If
'test it
Debug.Print fp
End Sub
[/code]
Any suggestions?