link to pdf file & menu bar in user form

  • Thread starter Thread starter Fendic
  • Start date Start date
F

Fendic

Hi,

I am new here and just started to learn Excel VBA. I've got a few
questions. Hope someone could give me a hand. :)

1) how to link a pdf file to a control button in a user form?
2) i found some code to add menu bar in a spreadsheet, but how to add
it in a user form?

thanks
 
Fendic,

1. the easiest way to launch a different programs file is to use the
ShellExecute API call.

Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub Test()
lreturn = ShellExecute(0, vbNullString, _
"E:\My Documents\My Downloads\Redmond Mags\RED_506DG.pdf", _
vbNullString, vbNullString, vbNormalFocus)
End Sub

2. notionally you can't. the forms object model doesn't support menus. You
can do it in VB, but not VBA. There have been some kludge workarounds, but I
wouldn't recommend it unless absolutely crucial to you.

Robin Hammond
www.enhanceddatasystems.com
 
Hi Robin,

I really appreciate your help. The code works, only that I need t
declare the function at the top of standard VBA module, which took m
an hour to find out. hehe :rolleyes:

At this level, I wonder if you or anyone else knows how to turn to
certain page when the pdf file opens, or even a certain paragraph
line. I know html is able to work like that, and adobe has 'go to...
function. but not sure how to fix that in VBA code.

Thank you. I found more and more fun in VBA now :)

Fendi
 

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

Back
Top