Q: We have a method “OA1.WordGotoItem wdGoToPage, wdGoToNext”. In a web page this method doesn’t work. Is there any way to use this method in a web page?
A: Referent the follow enums then write the number in the function.
OA1.WordGoToItem 1, 2
3 Responses to “How to go to the special item in a Word document via VBA”
Leave a Reply
You must be logged in to post a comment.
January 8th, 2008 at 8:49 am
typedef enum BorderStyle
{
BorderNone = 0,
BorderFlat,
Border3D,
Border3DThin
} BorderStyle;
typedef enum ShowDialogType
{
DialogNew = 0,
DialogOpen,
DialogSave,
DialogSaveCopy,
DialogPrint,
DialogPageSetup,
DialogProperties
} ShowDialogType;
typedef enum FileCommandType
{
FileNew = 0,
FileOpen,
FileClose,
FileSave,
FileSaveAs,
FilePrint,
FilePageSetup,
FileProperties,
FilePrintPreview
} FileCommandType;
typedef enum XlFileFormat
{
xlAddIn = 18,
xlCSV = 6,
xlCSVMac = 22,
xlCSVMSDOS = 24,
xlCSVWindows = 23,
xlDBF2 = 7,
xlDBF3 = 8,
xlDBF4 = 11,
xlDIF = 9,
xlExcel2 = 16,
xlExcel2FarEast = 27,
xlExcel3 = 29,
xlExcel4 = 33,
xlExcel5 = 39,
xlExcel7 = 39,
xlExcel9795 = 43,
xlExcel4Workbook = 35,
xlIntlAddIn = 26,
xlIntlMacro = 25,
xlWorkbookNormal = -4143,
xlSYLK = 2,
xlTemplate = 17,
xlCurrentPlatformText = -4158,
xlTextMac = 19,
xlTextMSDOS = 21,
xlTextPrinter = 36,
xlTextWindows = 20,
xlWJ2WD1 = 14,
xlWK1 = 5,
xlWK1ALL = 31,
xlWK1FMT = 30,
xlWK3 = 15,
xlWK4 = 38,
xlWK3FM3 = 32,
xlWKS = 4,
xlWorks2FarEast = 28,
xlWQ1 = 34,
xlWJ3 = 40,
xlWJ3FJ3 = 41,
xlUnicodeText = 42,
xlHtml = 44
}XlFileFormat;
typedef enum WdSaveFormat
{
wdFormatDocument = 0,
wdFormatTemplate = 1,
wdFormatText = 2,
wdFormatTextLineBreaks = 3,
wdFormatDOSText = 4,
wdFormatDOSTextLineBreaks = 5,
wdFormatRTF = 6,
wdFormatUnicodeText = 7,
wdFormatEncodedText = 7,
wdFormatHTML = 8,
wdFormatWebArchive = 9,
wdFormatFilteredHTML = 10,
wdFormatXML = 11
}WdSaveFormat;
typedef enum PpSaveAsFileType
{
ppSaveAsPresentation = 1,
ppSaveAsPowerPoint7 = 2,
ppSaveAsPowerPoint4 = 3,
ppSaveAsPowerPoint3 = 4,
ppSaveAsTemplate = 5,
ppSaveAsRTF = 6,
ppSaveAsShow = 7,
ppSaveAsAddIn = 8,
ppSaveAsPowerPoint4FarEast = 10,
ppSaveAsDefault = 11,
ppSaveAsHTML = 12,
ppSaveAsHTMLv3 = 13,
ppSaveAsHTMLDual = 14,
ppSaveAsMetaFile = 15,
ppSaveAsGIF = 16,
ppSaveAsJPG = 17,
ppSaveAsPNG = 18,
ppSaveAsBMP = 19
}PpSaveAsFileType;
typedef enum PpViewType
{
ppViewHandoutMaster = 4,
ppViewMasterThumbnails = 12,
ppViewNormal = 9,
ppViewNotesMaster = 5,
ppViewNotesPage = 3,
ppViewOutline = 6,
ppViewPrintPreview = 10,
ppViewSlide = 1,
ppViewSlideMaster = 2,
ppViewSlideSorter = 7,
ppViewThumbnails = 11,
ppViewTitleMaster =8,
}PpViewType;
typedef enum WdViewType
{
wdMasterView = 5,
wdNormalView = 1 ,
wdOutlineView = 2,
wdPrintPreview = 4 ,
wdPrintView = 3,
wdReadingView = 7,
wdWebView = 6,
}WdViewType;
typedef enum XlViewType
{
xlNormalView = 1 ,
xlPageBreakPreview = 2,
}XlViewType;
typedef enum WdPasteDataType
{
wdPasteBitmap = 4,
wdPasteDeviceIndependentBitmap = 5,
wdPasteEnhancedMetafile = 9,
wdPasteHTML = 10,
wdPasteHyperlink = 7,
wdPasteMetafilePicture = 3,
wdPasteOLEObject = 0,
wdPasteRTF = 1,
wdPasteShape = 8,
wdPasteText = 2,
}WdPasteDataType;
typedef enum WdBreakType{
wdPageBreak = 7,
wdColumnBreak = 8,
wdSectionBreakNextPage = 2,
wdSectionBreakContinuous = 3,
wdSectionBreakEvenPage = 4,
wdSectionBreakOddPage = 5,
wdLineBreak = 6,
wdLineBreakClearLeft = 9,
wdLineBreakClearRight = 10,
wdTextWrappingBreak = 11,
}WdBreakType;
typedef enum WdGoToItem{
wdGoToBookmark = -1 ,
wdGoToComment = 6 ,
wdGoToEndnote = 5 ,
wdGoToEquation = 10 ,
wdGoToField = 7 ,
wdGoToFootnote = 4 ,
wdGoToGrammaticalError= 14 ,
wdGoToGraphic = 8 ,
wdGoToHeading= 11 ,
wdGoToLine = 3 ,
wdGoToObject = 9 ,
wdGoToPage = 1 ,
wdGoToPercent = 12 ,
wdGoToProofreadingError = 15 ,
wdGoToSection = 0 ,
wdGoToSpellingError = 13 ,
wdGoToTable = 2 ,
}WdGoToItem;
typedef enum WdGoToDirection{
wdGoToAbsolute = 1,
wdGoToFirst = 1,
wdGoToLast = -1 ,
wdGoToNext = 2 ,
wdGoToPrevious = 3 ,
wdGoToRelative = 2 ,
}WdGoToDirection;
typedef enum WdPageFit{
wdPageFitBestFit = 2,
wdPageFitFullPage = 1,
wdPageFitTextFit = 3 ,
wdPageFitTextNone = 0 ,
}WdPageFit;
typedef enum OpenedFileType{
oaUnknown = -1,
oaNoOpened = 0,
oaWord = 1,
oaExcel = 2,
oaPowerPoint = 3 ,
oaVisio = 4 ,
oaProject = 5 ,
}OpenedFileType;
July 17th, 2010 at 10:12 am
In Javascript you need to provide all of the arguments (in order) even though they are optional.
var objWord = document.OA1.ActiveDocument;
var app = objWord.Application;
var sel = app.Selection;
var empty;
var objRange = sel.GoTo(-1, empty, 0, ‘method’);
July 17th, 2010 at 10:14 am
To move the bookmark “method”
var empty;
document.OA1.GotoItem(-1, empty, 0, ‘method’);