Why does adding MsgBox change my results?

Re: Why does msgbox seem to change my subroutine?

Yes, same error.
 
Re: Why does msgbox seem to change my subroutine?

Revert back to the Variant declaration (no array declaration). This is how you use the GetTitle:

PDBookmarker.GetTitle "Untitled"
 
Re: Why does msgbox seem to change my subroutine?

Revert back to the Variant declaration (no array declaration). This is how you use the GetTitle:

PDBookmarker.GetTitle "Untitled"


It's giving me "wrong number of arguments"
 
Re: Why does msgbox seem to change my subroutine?

I realised. Post a test document.
 
Re: Why does msgbox seem to change my subroutine?

I'm wondering if it isn't a TIMING issue. When you do the breakpoint and step through it, what happens if you wait 5 seconds before pressing F8 after running this line:
PDBookmarker.SetTitle (element)

I agree that it sounds like a timing issue due to asynchronous processing of the commands in the VB Code Loop. It is possible that a DoEvents command inserted in place of the MsgBox, might help to synchronize the processing in this case.
 
Re: Why does msgbox seem to change my subroutine?

That pdf is what I am using to test this with. It should post Atlanta and then spam Boston for the rest of the bookmark names.
 
Re: Why does msgbox seem to change my subroutine?

I agree that it sounds like a timing issue due to asynchronous processing of the commands in the VB Code Loop. It is possible that a DoEvents command inserted in place of the MsgBox, might help to synchronize the processing in this case.

DoEvents unfortunately did not work either
 
Re: Why does msgbox seem to change my subroutine?

Just saw your post. Can you post the Class?
 
Re: Why does msgbox seem to change my subroutine?

Not sure what I should be posting in response to that, but I have these global declarations, if this helps any:

'declarations:
Global Const dhcRegSz = 1


Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As _
Long) As Long

Public Declare Function RegSetValueEx _
Lib "advapi32.dll" Alias "RegSetValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, _
ByVal dwReserved As Long, ByVal dwType As Long, _
lpData As Any, ByVal cbData As Long) As Long

Public Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long



Reference here is simply "Acrobat", GUID {E64169B3-3592-47D2-816E-602C5C13F328}
 
Re: Why does msgbox seem to change my subroutine?

Is anyone able to replicate the error?
 
Re: Why does msgbox seem to change my subroutine?

I am ready to bash my head in over this. It just boggles me as to why this isn't working.
 
Re: Why does msgbox seem to change my subroutine?

Just having a look now.
 
Re: Why does msgbox seem to change my subroutine?

Is there a bug or is it just me? Can't seem to create the AcroExch object.
 
Re: Why does msgbox seem to change my subroutine?

Do you have Acrobat full?
 
Re: Why does msgbox seem to change my subroutine?

I don't really think this is an Access issue. It's an automation issue with an outside library, and maybe you should ask your question in the forum for programming Acrobat from VB/VBA.
 
Re: Why does msgbox seem to change my subroutine?

There wasn't an Acrobat forum from what I saw.

At any rate, why would msgbox interfere favorably? I assumed they were truly just... independent and didn't do anything. But my question is how to synthesize that underlying property in a way that isn't a messagebox (i.e. just getting it to populate the names correctly).
 
Re: Why does msgbox seem to change my subroutine?

Sorry for this very wild guess but: -

AcroApp.MenuItemExecute ("NewBookmark") (or one of the other lines)

might hold the focus and clicking on the MsgBox might remove the focus.

But if by some chance it is correct then rather than the MsgBox try setting focus to some other control.

(I did say it was wild.)
 
Re: Why does msgbox seem to change my subroutine?

It might also need a mouse click: -


Code:
[color=green]'Before you start this program, I suggest you save everything that wasn't saved.[/color]
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _
                                              ByVal dx As Long, _
                                              ByVal dy As Long, _
                                              ByVal cButtons As Long, _
                                              ByVal dwExtraInfo As Long)

Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_MOVE = &H1
Private Const MOUSEEVENTF_ABSOLUTE = &H8000
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10


Public Sub SimulateMouseClick()
    [color=green]'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
        
    'Simulate a mouseclick on the cursor's position[/color]
    mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, 0, 0
    
    DoEvents

End Sub
 

Users who are viewing this thread

Back
Top Bottom