Programmatically Set Startup Options

N

nomadk

A2003, XP Pro

Is there a way to set Startup Options (as in Tools/Startup...) from the
autoexec macro?

Specifically, I'd like to set the Application Icon to an icon file in the
Graphics folder installed with my app. I use the public function:

"ImagePath = CurrentProject.Path & "\Graphics"" to find the images for all
of the buttons in my app, can I do the same for the Application Icon?

Thanks.
 
K

Ken Sheridan

Add the following to a module:

Public Sub ChangeIcon(strIcon As String)

Dim strMessage As String

strMessage = "Unable to change application icon to " & strIcon

If ChangeProperty("AppIcon", dbText, strIcon) Then
Application.RefreshTitleBar
Else
MsgBox strMessage, vbExclamation, "Error"
End If

End Sub


Public Function ChangeProperty(strPropName As String, varPropType As
Variant, varPropValue As Variant) As Boolean

Dim dbs As DAO.Database, prp As DAO.Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Exit:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then 'property not found
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
'unkown error
ChangeProperty = False
Resume Change_Exit
End If

End Function

Then call the ChangeIcon procedure, passing the path to the icon file into it.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top