[AccessD] MS-Word import into Access

pedro at plex.nl pedro at plex.nl
Thu Dec 2 14:38:53 CST 2010


Hello Shamil,

Thanks for the code.
when i make a new macro from your code.
The code is not accepted as a macro.

When using the sub ReplaceTabs name, or another sub name, closing the visual basic editor, and go to macro's, the macro is not present.

I has something to do with the reference: (ByRef rdoc As Word.Document)
When using it after the sub-name the macro isn't recognized a macro, and i can't start the macro (also not from within the visual basic editor).
When i don't use it after the sub-name, i get an error: object not present.
and Set wapp = rdoc.Application is highlighted.
Any suggestions?

Pedro 




In antwoord op:

> From: "Shamil Salakhetdinov" <shamil at smsconsulting.spb.ru>
> To: "'Access Developers discussion and problem solving'"
> Date: Thu, 2 Dec 2010 15:33:15 +0300
> Subject: Re: [AccessD] MS-Word import into Access
> 
> 
> Hi Pedro --
> 
> Just "quick&dirty - extend it yourself" sample - mainly recorded in MS Word
> then wrapped into a sub:
> 
> Public Sub ReplaceTabs(ByRef rdoc As Word.Document)
> Dim wapp As Word.Application
>     Set wapp = rdoc.Application
>     rdoc.Select
>     With wapp.Selection.Find
>         .Text = "^t"
>         .Replacement.Text = ";"
>         .Forward = True
>         .Wrap = 1 'wdFindContinue
>         .Format = False
>         .MatchCase = False
>         .MatchWholeWord = False
>         .MatchAllWordForms = False
>         .MatchSoundsLike = False
>         .MatchWildcards = True
>     End With
>     wapp.Selection.Find.Execute Replace:=2 'wdReplaceAll
>         
>     Set wapp = Nothing
> End Sub
> 
> 
> Thank you.
> 
> --
> Shamil
>  
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of pedro at plex.nl
> Sent: 2 ??????? 2010 ?. 12:55
> To: accessd at databaseadvisors.com
> Subject: [AccessD] MS-Word import into Access
> 
> I have to import data from MS-Word documents into Acces.
> The data in the documents are four text-parts, and between them are one ore
> more tabs. 
> 
> Because of the difference in tabs, i can use replace, but i have many
> documents, so it would take days to do that.
> Is there a code that i could use as a macro in MS-Word to delete one ore
> more tabs and replace them with ";".
> 
> Not really an Access problem, i'll hope that it is no problem to post it
> here
> 
> Thanks 
> 
> Pedro
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 



More information about the AccessD mailing list