![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
![]()
Firstly when you declare variables you should explicitly define each variable's type
Dim pregunta, opA, opB, opC, opD, ans, respC, explRC, dif, ref, obj, topic, pclave, prof As String In the above declaration, only prof is a string. All the other variables are variants. It needs to be written as Dim pregunta as String, opA as String, opB as String Secondly, your code creates a document and then start looping through the rows and before you move to the next row, you close the document. This means on the second pass of the loop, the document is no longer open. Did you want one document per row or are you creating a single document containing all the row content?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#2
|
|||
|
|||
![]()
Truly very grateful. It is true!! I have removed 'objselection.Close savechanges: = True and now I have all the rows in one word document, which is how I need.
Now .TypeText num and .TypeText pts which is the numerical order of column A (from A8 ...) and Column J (from J8 ..) 3 points for each row I have now declared these num and pts variables as a variant, ... but it still gives me an error How should I declare them so that I don't get an error? |
![]() |
Tags |
excel 2013, vba, word 2013 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
reverse order of paragraphs, word 2010 | moorea21 | Word VBA | 1 | 08-02-2018 03:47 AM |
![]() |
Ivica | Word | 3 | 12-28-2015 01:31 PM |
![]() |
FromF | Excel | 2 | 09-09-2014 02:30 AM |
Office 2010 Excel Full pass | raineraus | Excel | 1 | 09-19-2012 12:55 PM |
![]() |
Coreysan | Mail Merge | 3 | 12-11-2011 04:22 PM |