Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-10-2022, 05:08 AM
Italophile Italophile is offline Why does the document get selected after undo-ing my script? Windows 11 Why does the document get selected after undo-ing my script? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 565
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

In VBA each variable declared on the same line needs to be given a datatype. In your declarations only the last variable on the line is typed. This results in all the other variables being assigned the default datstype of Variant.

So

Code:
Dim scriptName, str_prompt, str_lower1,…
Should be

Code:
Dim scriptName as String, str_prompt as String, str_lower1 as String,…
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a selected range of a document to a new document with preserving formatting,header and footer RobertDany Word VBA 10 08-10-2021 04:04 AM
Insert Comments from List for Whole Document and for Only Selected Portion of Document rekent Word VBA 8 11-10-2020 11:01 PM
Why does the document get selected after undo-ing my script? Copy selected text from one document and paste to new document in same position on the page gasparik Word VBA 1 05-11-2020 05:41 AM
Why does the document get selected after undo-ing my script? When multiple documents open, undo/redo in one document affects others? seanspotatobusiness Word 3 07-28-2018 03:15 PM
Why does the document get selected after undo-ing my script? Can I undo a repaired document? uberscribbler Word 2 11-18-2014 11:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft