Mike.and.H
Programmer
I’m not very fluent in VB macro language but somebody has to do it. My problem is with a syntax error that I don’t see the reason. This is an Attachmate macro to work with MS Word document. I will have a template document fully edited and formatted with bookmarks for screen shots. Macro will open this document, issue Attachmate command to grab a screen and use Word Selection.GoTo method to position at proper bookmark and paste screen shot there. Problem is that when I use required four GoTo parameters this statement is flagged as syntax error. When I coded just one parameter it was compiled fine but I need four. Other Word methods, EndOf, TypeText, Paste compile fine and work fine. What am I doing wrong?
'****************************
'* Paste screen into Word
'****************************
sub pasteScreenDoc (byRef tsoSession as object, byRefr objDoc as object, strDesc as String, strScreen as String)
Dim wdWhat As Integer ' GoToBookmark = -1
Dim wdWhich As Integer ' GoToFirst = 1
Dim wdCnt As Integer ' Count = 1
Dim objSelection As object
'****************************
'* Print Screen and paste to Word
'****************************
SendKeys "%{PRTSCR}", True
Set objSelection = objDoc.application.Selection
'
wdWhat% = -1
wdWhich% = 1
wdCount% = 1
objSelection.GoTo(wdWhat,wdWhich,wdCnt,strScreen) '<= marked as syntax
' objSelection.GoTo(strScreen) <= this is ok
objSelection.TypeText(strDesc)
objSelection.Paste
end sub
'****************************
'* Paste screen into Word
'****************************
sub pasteScreenDoc (byRef tsoSession as object, byRefr objDoc as object, strDesc as String, strScreen as String)
Dim wdWhat As Integer ' GoToBookmark = -1
Dim wdWhich As Integer ' GoToFirst = 1
Dim wdCnt As Integer ' Count = 1
Dim objSelection As object
'****************************
'* Print Screen and paste to Word
'****************************
SendKeys "%{PRTSCR}", True
Set objSelection = objDoc.application.Selection
'
wdWhat% = -1
wdWhich% = 1
wdCount% = 1
objSelection.GoTo(wdWhat,wdWhich,wdCnt,strScreen) '<= marked as syntax
' objSelection.GoTo(strScreen) <= this is ok
objSelection.TypeText(strDesc)
objSelection.Paste
end sub